On Wed, Jan 21, 2009 at 11:30:58AM -0500, Igor Tandetnik wrote:
> One advantage of the string format is that it's visible to the "naked 
> eye" - when working with the database using generic tools (e.g. for 
> administration or troubleshooting). It's a pain to run ad-hoc queries 
> when the database stores dates as, say, Julian days (which just look 
> like huge numbers, all alike).

And using international date format also allows you to use
LIKE/GLOB/REGEXP to efficiently express BETWEEN:

    SELECT ... FROM ... WHERE tstamp LIKE '2007-08-%' ...;

Expressing the same using seconds since the Unix epoch is more
complicated:

    SELECT ... FROM ... WHERE tstamp BETWEEN
        strftime('%s', '2007-08-01') AND
        strftime('%s', '2007-08-31') ...;

OTOH, using seconds since the Unix epoch too makes some computations
simpler.  You could always store timestamps both ways.

Nico
-- 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to