Convert String type to Timestamp type

Convert from String type to Timestamp type

			//Convert from String type to Timestamp type
			//Receive values from form and combine
			String delivery = form.getDeliveryDate() + " " + form.getDeliveryTime();
			//format Description for conversion
		    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh");
		    java.util.Date parsedDate = null;
			try {
				parsedDate = dateFormat.parse(delivery);
			} catch (ParseException e) {
				e.printStackTrace();
			}
		    Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());

I will leave it as a memorandum. If there is any other good way, please teach me!

Recommended Posts

Convert String type to Timestamp type
[Java] Convert Object type null to String type
Convert to Ruby Leet string
I want to convert InputStream to String
How to convert LocalDate and Timestamp
Convert iso-2022-jp character string to utf-8
[Java] How to convert a character string from String type to byte type
I tried to convert a string to a LocalDate type in Java
[Convenient to remember !!!] How to convert from LocalDate type to character string and from character string to LocalDate type
[Java] How to convert from String to Path type and get the path
Type conversion from java BigDecimal type to String type
Convert to a tag to URL string in Rails
[Android] How to convert a character string to resourceId
Convert a string to a character-by-character array with swift
URL to String conversion
Uri → String, String → Uri type conversion
How to type backslash \
<java> Read Zip file and convert directly to string
Sample code to convert List to List <String> in Java Stream
[Kotlin] Convert ZonedDateTime to String by specifying the format
Convert Java Powerpoint to XPS
I want to convert characters ...
Convert a Java byte array to a string in hexadecimal notation
Convert Serializable Object to byte []
How to use String [] args
Initialization with an empty string to an instance of Java String type
Convert from ○ months to ○ years ○ months
How to convert Java radix
Change only one character from the String type string to uppercase
[Java] Convert ArrayList to array
Format Timestamp type in Thymeleaf
Convert formulas to reverse Polish notation
Convert alphabet to 26 base + array length
Convert Map <K, V1> to Map <K, V2> (Convert Map Value)
Convert ruby object to JSON format
Convert Markdown to HTML with flexmark-java
How to convert erb file to haml
[Java] Convert 1-to-N List to Map
[Java] Correct comparison of String type
[Android] Convert Android Java code to Kotlin
[Small story] Convert Stream to Iterable
[Java] Convert array to ArrayList * Caution
How to use Java enum type
Convert Swift 2D array to C 2D array