On Tue, Apr 17, 2012 at 2:44 PM, Nico Williams <n...@cryptonector.com>wrote:

> On Tue, Apr 17, 2012 at 11:18 AM, Mark Jones <m...@jonesgroup.co.uk>
> wrote:
> > I think I'll spend the time going back and storing the dates as integer
> > time (since the epoch) as Nico suggested and just use strftime to convert
> > them as and when required.
>
> Note that you'll lose any fractional second information when you do
> this.  On the other hand, fractional second information does not sort
> properly when compared as text,


Huh?  The standard format is YYYY-MM-DD HH:MM:SS.SSS.  I think that sorts
in time order when compared as strings.  Do you have a counter-example?



> so if you need sub-second resolution
> you need to work a little harder.
>
> (Huh, that is strange.  Is there a canonical way to compare timestamps
> with fractional seconds in SQLite3?)
>

The julian day number, stored as a double-precision floating point number
gives you millisecond resolution in the modern era.  Julian day number is
the default and preferred format for dates/times in SQLite.


sqlite> select datetime('now'), julianday('now');
2012-04-17 19:45:11|2456035.32305485





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



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to