开发者

Parsing and setting a date

开发者 https://www.devze.com 2023-01-21 14:05 出处:网络
I have dates like - 15-JUL-10 00:00:00 12-AUG-10 23:59:59 24-SEP-10 18:13:18 How do I easily parse开发者_运维问答 these sort of dates and assign to a Date object?Using java.text.SimpleDateFormat:

I have dates like -

15-JUL-10 00:00:00

12-AUG-10 23:59:59

24-SEP-10 18:13:18

How do I easily parse开发者_运维问答 these sort of dates and assign to a Date object?


Using java.text.SimpleDateFormat:

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


Use SimpleDateFormat.

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号