Languages
[Edit]
EN

MySql - how to convert unix timestamp to datetime?

7 points
Created by:
AnnLen
1777

Using MySql it is possible to convert UNIX timestamp to datetime in following way.

1. Built-in FROM_UNIXTIME function example

This example shows a new column with timestamp converted to a more readable form.

SELECT *, FROM_UNIXTIME(`sent_at`) AS `sent_at_datetime`
FROM `messages`
WHERE `sender_name` = 'John';

 

Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.