Jump to content
684425

convert unixtime to date

Recommended Posts

I have a column (unix_values) in table where multiple values are stored in unix timestamp which i want to convert into date yyyy-mm-dd and copy to another column (date_values) using single query

Any help please?

Share this post


Link to post
Share on other sites

Just for the record...

mysql> select * from datetest;
+------------+------+
| unix       | date |
+------------+------+
| 1576972800 | NULL |
| 1579651200 | NULL |
| 1582329600 | NULL |
+------------+------+

mysql> UPDATE datetest SET date = from_unixtime(unix);

mysql> select * from datetest;
+------------+------------+
| unix       | date       |
+------------+------------+
| 1576972800 | 2019-12-22 |
| 1579651200 | 2020-01-22 |
| 1582329600 | 2020-02-22 |
+------------+------------+

 

  • Great Answer 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.