A MySQL database field with times similar to '1752463231.455827'
How to query the time and show it as '2025-07-14 17:22:28.911723'
-- set timezone
SET time_zone='Australia/Melbourne';
USE mydb;
SELECT
created_on,
from_unixtime(created_on) as event_melb_time
FROM
mytable

How to tell the precision of Unix Time
Unix time is in seconds, but if there is a decimal point the following number of digits specifies the precision:
- 1 digit: Tenths of a second = 1/10 of a second
- 2 digits: Hundredths of a second = 1/100 of a second
- 3 digits: Milliseconds = A Millisecond is 1/1,000 of a second
- 6 digits: Microseconds = A Microsecond is 1/1,000,000 of a second
- 9 digits: Nanoseconds = A Nanosecond is 1/1,000,000,000 of second
0 Comments