Dave's Brain

Browse - Programming Tips - What's the most sensible way to display (or save) the date and time?

Date: 1998jan12
Keywords: sane, sanity

Q.  What's the most sensible way to display (or save) the date and time?

A.

A lot of programs read and write files
that contain the date and time.  I can not think of
a better way to represent the date than the standard way:

YYYY-MM-DD HH:MM:SS
The link below describes the International Standard Organization's (ISO 8601) standard. My programs use this format wherever possible. More info http://www.cl.cam.ac.uk/~mgk25/iso-time.html --- Another nice way is:
YYYYMMMDD
eg:
1998jan12
This isn't immediately sortable but it is readable but all English speakers. There is no ambiguity on any fields. Of course, its no good for people who don't read English.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.