Snippets tagged “simpledateformat”
13 snippets use this tag.
- Calendar date to yyyy-MM-dd format in javaJava
To format a Calendar date in the yyyy-MM-dd format in Java, you can use the SimpleDateFormat class.
- Convert java.util.Date to StringJava
To convert a java.util.Date object to a String, you can use the format method of the SimpleDateFormat class from the java.text package. The SimpleDateFormat class provides a convenient way to convert a Date object to a String based on a specified format.
- Converting ISO 8601-compliant String to java.util.DateJava
To convert an ISO 8601-compliant string to a java.util.Date object, you can use the java.text.SimpleDateFormat class and specify the "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" format, which is the ISO 8601 format for dates with a time and time zone.
- Display current time in 12 hour format with AM/PMJava
To display the current time in 12-hour format with AM/PM in Java, you can use the SimpleDateFormat class and the Calendar class.
- How to change date format in a Java string?Java
To change the date format in a Java string, you can use the SimpleDateFormat class.
- how to convert java string to Date objectJava
To convert a string to a Date object in Java, you can use the parse() method of the SimpleDateFormat class.
- How to get current timestamp in string format in Java? "yyyy.MM.dd.HH.mm.ss"Java
To get the current timestamp in string format in Java, you can use the SimpleDateFormat class and specify the desired format string.
- How to get the current time in YYYY-MM-DD HH:MI:Sec.Millisecond format in Java?Java
To get the current time in the YYYY-MM-DD HH:MI:Sec.Millisecond format in Java, you can use the SimpleDateFormat class and specify the desired format string:
- How to parse a date?Java
To parse a date in Java, you can use the SimpleDateFormat class.
- How to set time zone of a java.util.Date?Java
To set the time zone of a java.util.Date object in Java, you can use the Calendar class.
- Java format yyyy-MM-dd'T'HH:mm:ss.SSSz to yyyy-mm-dd HH:mm:ssJava
To convert a date in the format yyyy-MM-dd'T'HH:mm:ss.SSSz to the format yyyy-mm-dd HH:mm:ss, you can use the SimpleDateFormat class in Java.
- Java string to date conversionJava
To convert a string to a date in Java, you can use the parse method of the SimpleDateFormat class.
- java.util.Date format conversion yyyy-mm-dd to mm-dd-yyyyJava
To convert the format of a java.util.Date object from yyyy-MM-dd to MM-dd-yyyy, you can use the SimpleDateFormat class and its format() method.