Tuesday, 11 April 2017

Getting localtime from timestamp

I've a column updated declared as updated TIMESTAMP and is the only TIMESTAMP type column.

When I do select updated from pushinfo;

I get

+---------------------+
| updated             |
+---------------------+
| 2017-04-11 15:33:46 |
| 2017-04-11 15:35:02 |
| 2017-04-12 10:15:54 |
+---------------------+

When I use select FROM_UNIXTIME(updated) from pushinfo;

I'm getting

| FROM_UNIXTIME(updated) |
+------------------------+
| NULL                   |
| NULL                   |
| NULL                   |

Why doesn't FROM_UNIXTIME work?

When I use this query

conn.query(' select updated from pushinfo')

I'm getting the updated as something like YYYY-MM-DDTHH:MM:SS.000Z What's the problem?

How to get in the format of HH:MM:SS YYYY-MM-DD etc?



via user5858

No comments:

Post a Comment