Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to retrieve some data from sqlite database. I used the following query for that pupose

C#
SELECT * FROM tableName


It works fine for me
But I want to retrieve data on the basis of date as following

C#
SELECT * FROM tableName WHERE date=09-09-2013


This query shows no result, because date column in Sqlite database contains dates like
VB
1378307780519
1378350490627
1378381805222
1378383415433
1378387764681


I do not know what format of date it is.
Any one tell me how I can retrieve data according to user provided date just like

09-09-2013 or 09/09/2013

How user provided date can be compared with sqlite database date and data can be retrieved on the basis of that date

Thanks in Advance
Posted
Comments
[no name] 9-Sep-13 7:33am    
Looks to me like you are storing your datetime in your database as an epoch time so you would nee to convert the epoch time to the datetime format you want.

Maybe you can watch this page:
MySQL Date and Time Functions[^]
 
Share this answer
 
The SQLite date and time functions page[^] should help you out.

I'm guessing the numbers you have in your database are UNIX epoch with milliseconds - removing the final three digits gives me a recent date and time:
sqlite> select datetime(1378307780519 / 1000, 'unixepoch');
2013-09-04 15:16:20

sqlite> select datetime(1378350490627 / 1000, 'unixepoch');
2013-09-05 03:08:10
 
Share this answer
 
Comments
Ghulam Ali 9-Sep-13 8:03am    
Can you please give a complete query to retrieve data on the basis of date

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900