Joris Bolsens wrote:That's kind of part of the question, what would be the best way to store the date.
Actually, I suspect there's more than one question there:
1. What should your timestamp (which sounds to me like it's a String) look like?
2. How should I store the
information in that timestamp in
Java?
and if I do use java.util.Date, I can parse it to/from a string, correct?
Correct. Have a look at SimpleDateFormat.
If indeed your timestamp
is a String, then I would suggest strongly using
ISO 8601, and specifically its "Combined date and time in UTC" form, eg:
2013-08-08T18:34:00Z
It's not pretty, but it IS an international standard, so if you have to send it to anyone else it will be a format that they are familiar with (or they darn well should be
).
It also contains ALL the information necessary to convert
unequivocally to a Java
Date. If the timezone isn't specified, you have to make assumptions.
HIH
Winston