Analysis and date setting

I have dates like -

15-JUL-10 00:00:00

12-AUG-10 23:59:59

24-SEP-10 18:13:18

How to easily parse these dates and assign a Date object?

+3
source share
2 answers

Using java.text.SimpleDateFormat:

DateFormat df = new SimpleDateFormat("dd-MMM-yy HH:mm:ss");
df.parse(dateString);
+2
source

Use SimpleDateFormat .

DateFormat fmt = new SimpleDateFormat("dd-MMM-yy HH:mm:ss");
Date date = fmt.parse("15-JUL-10 00:00:00");
+1
source

Source: https://habr.com/ru/post/1770395/


All Articles