How to use the Unix Timestamp Converter
- Type or paste a Unix timestamp, an ISO 8601 date or an HTTP date. Select Now for the current time.
- The tool detects whether a number is in seconds, milliseconds, microseconds or nanoseconds.
- Copy any format: ISO 8601, SOQL literals, Apex code, your local time and more.
What a Unix timestamp is
A Unix timestamp counts the seconds since midnight UTC on 1 January 1970. It is how most systems store time internally, because it is a single number with no time zone attached. JavaScript and Java use milliseconds instead of seconds, which is why some timestamps have 13 digits instead of 10.
Dates in SOQL
SOQL compares DateTime fields with literals in a strict format: the date and time in UTC, with a Z or an explicit offset, and no quotes.
SELECT Id, Subject
FROM Case
WHERE CreatedDate >= 2026-11-15T10:00:00Z
AND ClosedDate = 2026-11-20Date fields such as CloseDate take a plain YYYY-MM-DD date. For rolling ranges, SOQL date literals such as LAST_N_DAYS:30 or THIS_MONTH are often better than fixed dates.
Dates in Apex
// A specific moment, in GMT
DateTime dt = DateTime.newInstanceGmt(2026, 11, 15, 10, 0, 0);
// From a Unix timestamp in milliseconds
DateTime fromEpoch = DateTime.newInstance(1794736800000L);
// Back to a Unix timestamp
Long epochMs = dt.getTime();Apex DateTime values are always stored in GMT. Methods such as format() and hour() convert to the running user’s time zone, while their Gmt versions do not. Mixing the two is the most common source of “off by a few hours” bugs.
Features and limitations
What it does
- Detects seconds, milliseconds, microseconds and nanoseconds from the number of digits.
- Accepts ISO 8601 with or without a time and offset, and HTTP / RFC 2822 dates.
- Produces SOQL DateTime and Date literals in exactly the format SOQL requires.
- Writes Apex
DateTime.newInstanceGmt(...)andDateTime.newInstance(milliseconds)code. - Shows your local time, your time zone and how long ago or ahead the moment is.
What it does not do
- Dates without a time zone are treated as UTC, and the tool says so.
- Natural-language input such as “next Tuesday” is not understood.
- Salesforce stores dates from the years 1700 to 4000; dates outside that range are flagged.