UTC Date to Unix Timestamp Converter
Treat your input as UTC (no offset applied) and get back the corresponding Unix timestamp. Useful when you have a wall-clock time you know is in UTC and need to store it as an integer.
Example: 2024-01-31T12:00:00Z
| Input (UTC Date) | 2024-01-31T12:00:00Z |
|---|---|
| Unix (seconds) | 1706702400 |
| Unix (milliseconds) | 1706702400000 |
| ISO 8601 (UTC) | 2024-01-31T12:00:00Z |
Common Pitfall
Note: If your UTC string lacks a timezone indicator, parsers may treat it as local - append `Z` or use a UTC-explicit parser like Python's `datetime.strptime(...).replace(tzinfo=timezone.utc)`.
Code Examples
Python
from datetime import datetime, timezone
int(datetime.strptime('2024-01-31 12:00:00', '%Y-%m-%d %H:%M:%S')
.replace(tzinfo=timezone.utc).timestamp())
JavaScript
Math.floor(Date.parse('2024-01-31T12:00:00Z') / 1000)
PHP
strtotime('2024-01-31 12:00:00 UTC');