Java default date formats

java.util.Date:
EEE MMM dd HH:mm:ss z yyyy

Notes:
- Milliseconds are not shown thus get lost.
- The day is only for "show" - it doesn't really affect the parsing.

java.sql.Timestamp
yyyy-MM-dd HH:mm:ss.S

Unit tests to test the above can be found here.

Q&A:
Q: Why do I post this?
A: There are applications that output the default 'toString' of dates, thus need to be parsed if the date needs to be "understood".
Q: What does the format above mean?
A: The formats are the convention of Java's SimpleDateFormat.

No comments:

Post a Comment