MySQL: Convert Unix Timestamp to Date
Question by Compi | 2016-03-10 at 12:52
I am getting a Unix Timestamp from one of my MySQL queries, that is a long number such as 1517440125 that is not really readable.
Because of that, I would like to transform this number into a readable format or a real date before reading out. I know the MySQL command UNIX_TIMESTAMP() with which you are able to convert a date into a Unix Timestamp, but isn't there any function to reverse that?
Related Topics
MySQL: Write current Date or Time into Column
Tutorial | 0 Comments
PHP: Current Date and Time
Tutorial | 0 Comments
PHP: Determine Week Number
Tutorial | 0 Comments
JavaScript: Get current Date and Time
Tutorial | 1 Comment
Change Date of File
Tutorial | 0 Comments
Delphi/Lazarus: Display current Date and Time
Tip | 0 Comments
Convert many CSV Files to XLSX or ODS Spreadsheets
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
Yes, there is a function.
It is called FROM_UNIXTIME and you can use it with or without parameter.
Without parameter the result will be this format. If you want to determine your own format, you can pass the formatting as parameter:
As you can see, %d is standing for the day, %m for the month, %Y for the year and so on. You can use other characters between those placeholders like points or spaces as you can see in the example.
2016-03-10 at 14:23