Unix Timestamp Converter for MySQL & PHP
Paste a timestamp (1760707200), milliseconds, an ISO date, or a MySQL value like 2026-10-17 14:30:00. Pick the time zone and copy the format you need.
FreeNo sign-upRuns in your browser: your data is not uploaded
Current Unix time: 0
What a Unix timestamp is
The number of seconds since 1 January 1970, 00:00 UTC. It has no time zone: 1760707200 is the same moment in Riyadh, Karachi and London. The time zone only matters when you turn it into a wall-clock date, which is where most bugs come from.
MySQL: DATETIME vs TIMESTAMP
| DATETIME | TIMESTAMP | |
|---|---|---|
| Stores | The date and time exactly as given | UTC, converted from and to the session time zone |
| Range | 1000 to 9999 | 1970 to 2038-01-19 |
| Changes if the server time zone changes? | No | Yes, on display |
Laravel creates created_at and updated_at as TIMESTAMP and writes them in APP_TIMEZONE (UTC by default). If you see times off by exactly three or five hours, compare config/app.php timezone, PHP's date.timezone and MySQL's SELECT @@session.time_zone;. Keeping all three on UTC and converting only for display avoids almost all of it.
Converting in code
- PHP:
date('Y-m-d H:i:s', $ts)usesdate_default_timezone_get();strtotime('2026-10-17 14:30:00')goes the other way. - Laravel / Carbon:
Carbon::createFromTimestamp($ts, 'Asia/Riyadh')and$date->timestamp. - MySQL:
FROM_UNIXTIME(ts)andUNIX_TIMESTAMP(datetime), both in the session time zone. - JavaScript:
Date.now()is in milliseconds. Divide by 1000 before sending it to PHP or MySQL. A 13-digit number is the giveaway; this page detects it automatically.
The 2038 problem, briefly
Signed 32-bit timestamps end on 19 January 2038. 64-bit PHP is fine, but MySQL's TIMESTAMP type stops there. For dates that may go past 2038, such as contract end dates or 15-year schedules, use DATETIME.
FAQ
Why is my converted time a few hours off?
APP_TIMEZONE, date.timezone, MySQL time_zone) and the values will match.Is the number in seconds or milliseconds?
What does the page do with daylight saving time?
How do I store a timestamp in MySQL?
BIGINT with the raw number, or converted with FROM_UNIXTIME() into a DATETIME/TIMESTAMP column. Laravel's timestamps() uses TIMESTAMP columns.Related guides
- How to select multiple columns based on a condition in SQL?
- What Is the Host Parameter in mysqli_connect()?
- Data Truncated for Column at Row 1 on CHAR(1): Cause and Fix
- Fix mysql_fetch_array() Expects Parameter 1 to Be Resource
Link to this tool
Found it useful? Put a link in your docs, README or forum answer so others can use it too:
<a href="https://headsntail.com/tools/unix-timestamp-converter">Unix Timestamp to Date Converter (MySQL, PHP)</a> (free, by HeadsNTail)
[Unix Timestamp to Date Converter (MySQL, PHP)](https://headsntail.com/tools/unix-timestamp-converter)
Share: X LinkedIn Reddit WhatsApp
Need it done on your server? HeadsNTail sets up Laravel apps, cPanel hosting and migrations for businesses. See services or ask a question.