dateTime to Readable format

459 views
Skip to first unread message

Caleb Pocock

unread,
Oct 29, 2013, 12:23:04 PM10/29/13
to weewx...@googlegroups.com
Hello,
I am using a Vantage Pro2 weather station and am storing the data on a MySQL server, however the dateTime column is a long (example: '1383062640'), and I am having difficulty figuring out how to convert that into something that I can understand.

Thanks

Heli Os

unread,
Oct 29, 2013, 1:48:41 PM10/29/13
to weewx...@googlegroups.com
On linux/unix you could use "date"

like:
~$ date -d @1383062640
Tue Oct 29 17:04:00 CET 2013

Thomas Keffer

unread,
Oct 29, 2013, 5:35:40 PM10/29/13
to weewx-user
The column dateTime is in "unix epoch time," which, as you've discovered, is a big opaque number. 

You didn't say why and where you need to convert it. If it's just for oversight purposes using the mysql command line interface, then use the FROM_UNIXTIME() function:

mysql> SELECT FROM_UNIXTIME(dateTime) FROM weewx.archive LIMIT 5;

will print out the first five timestamps in your archive database in local time.

-tk




--
You received this message because you are subscribed to the Google Groups "Weewx user's group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Message has been deleted

John Masters

unread,
Oct 30, 2013, 9:59:49 AM10/30/13
to weewx...@googlegroups.com

Andrew Milner

unread,
Oct 30, 2013, 10:49:25 AM10/30/13
to weewx...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages