On Sep 15, 2013, at 8:31 PM, William Drago <wdr...@suffolk.lib.ny.us> wrote:

> Thanks for the reply. Seconds since the epoch does make a good timestamp. Is 
> that what is normally used to extract data between time periods?

(Date & Time seems to be a popular topic at the moment)

There is nothing prescriptive in using epoch time.

As SQLite doesn't have a dedicated date type, you are free to decide how you 
want to handle it.

There are two main encoding:

(1) As a number: Julian date, unix epoch, etc
(2) As a string: ISO 8601 & co.. Just make sure that your string representation 
sorts properly.

http://www.sqlite.org/lang_datefunc.html

The granularity of the date is up to you as well: day, hour, milliseconds, etc. 
This is more driven by what's convenient for your application. Ditto if this 
should be split between date &  time.

Depending on the task at hand, you could even require a much more full fledge 
set of entities:

  create table if not exists date
  (
    id            integer not null constraint date_pk primary key,

    year          integer not null,
    month         integer not null,
    day           integer not null,

    day_of_year   integer not null,
    day_of_week   integer not null,
    week_of_year  integer not null,

    constraint    date_uk unique( year, month, day )
  )

  create table if not exists time
  (
    id          integer not null constraint time_pk primary key,

    hour        integer not null,
    minute      integer not null,
    second      integer not null,

    constraint  time_uk unique( hour, minute, second )
  )

And then there are timezones, etc…



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

Reply via email to