Dennis Cote wrote:

Mario Frasca wrote:
where I would expect:
sqlite> select datetime('now');
2006-08-03 11:36:32.211032
sqlite> select typeof(datetime('now'));
datetime
sqlite> select datetime('now') - date('2006-01-01');
214 11:36:51.291331
sqlite> select typeof(datetime('now') - date('2006-01-01'));
timedelta

Mario,

The DATE and DATETIME types you seem to be expecting are handled
in SQLite as Julian dates. These are floating point numbers that
[...]

The TIMEDELTA type is also represented as a floating point number
[...]

Try these queries instead: [...]
nice.  if I was just working inside of SQL and was only interested in printing 
the values, it would probably be fine.  my problem is that I'm co-author of a 
python library (http://ibo.sourceforge.net) on top of various db-api2 interface 
libraries to three or four db engines (four, if I can include sqlite).  one of 
the problems consists in writing and retrieving datetime data to the database.  
the dynamic typing of sqlite is not a problem, actually it fits quite good with 
the strong dynamic typing system of Python...  but then, when I write to just 
any field a value which is a date, I would like to get back a value which is a 
date, not a string or a floating point number.  the same goes for a datetime 
and a timedelta, which are each a separate type in python...

would it be difficult, or simply impossible, to implement these types in sqlite?

anyway thanks a lot for your answer and queries!

MF

Reply via email to