John x
John x

Reputation: 4031

How to get Date in proper Format

Using the windows shell when i try to query the mmssms.db like

sqlite> select address, date, body from sms;

it gives me the date in some weird format, how can i get it in proper Date format. Screen shot is attached.

enter image description here

Upvotes: 1

Views: 1607

Answers (3)

bytebender
bytebender

Reputation: 7491

There is a date(timestring, modifier, modifier, ...) function for sqlite, see here - http://www.sqlite.org/lang_datefunc.html

or the strftime(format, timestring) looks like it would work better

so something like:

sqlite> select address, strftime('%Y-%m-%d %H:%M:%S', date), body from sms;

Upvotes: 2

Manfred Moser
Manfred Moser

Reputation: 29912

It is a java timestamp in milliseconds..

Upvotes: 0

Brandt Solovij
Brandt Solovij

Reputation: 2134

Looks like a time date stamp. Look into the formatting and casting

This is TSQL specific but the concept is the same if the syntax varies slightly

http://anubhavg.wordpress.com/2009/06/11/how-to-format-datetime-date-in-sql-server-2005/

edit: Not my blog just a link I googled that covered what you are trying to accomplish faster than me typing it out.

edit #2 : Just to be thorough and unbiased, w3schools has a good tutorial on this here:

http://www.w3schools.com/sql/sql_dates.asp

good luck!

Upvotes: 1

Related Questions