RE: [sqlite4java] SQL Query using Date functions

98 views
Skip to first unread message

ser...@almworks.com

unread,
Apr 9, 2013, 8:13:45 AM4/9/13
to sqlit...@googlegroups.com

Please check http://sqlite.org/lang_datefunc.html for the specs of date functions. I think you need to use strftime function, and also take care of the time zone.

 

Igor

 

 

From: sqlit...@googlegroups.com [mailto:sqlit...@googlegroups.com] On Behalf Of thechr...@gmail.com
Sent: Tuesday, April 09, 2013 2:00 AM
To: sqlit...@googlegroups.com
Subject: [sqlite4java] SQL Query using Date functions

 

I referenced a Android Developers Sqlite post which state its advised to store dates cast to Integers.  Thus  during the data import into the sqlite database I converted the dates to the timemilliseconds.  For example if my date = 6-1-2012 09:08:49, it is converted to timemilliseconds or 1338559729000.  The value in the sqlite db is 1338559729000.  

 

When I use the following query I get the correct response:

select * from dataevent de  where de.datetime = 1338559729000 provides a correct answer

 

however when I use the following query

 

select * from dataevent de where de.datetime = '2012-06-01 09:08:49' 

 

select * from dataevent de where de.datetime = date( '2012-06-01 09:08:49')

 

My response is no data is found.  

 

Do I have a syntax issue?  Or do I have more fundamental misunderstanding related to Sqlite built in date functions?

--
You received this message because you are subscribed to the Google Groups "sqlite4java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlite4java...@googlegroups.com.
To post to this group, send email to sqlit...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlite4java?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages