Try the inputs from this article

Run the example or change the input to compare results. Tool functions and standard browser APIs calculate the results in your browser.

Run example

Changing the input clears the previous result.

Example input file

These are illustrative inputs. Result field names are code identifiers; see the article for units and conditions.

The tool’s UTC input rule differs from JavaScript’s default

Moyoutil appends Z to a date-time input and interprets it as UTC. JavaScript Date.parse interprets a date-time without a time zone in the device’s local time zone. Do not assume other APIs follow this tool’s input rule. The results below were checked using the site’s actual conversion function.

const { timestamp } = await import('/extra-core.js');
timestamp('1704067200', 'ms').iso
// '1970-01-20T17:21:07.200Z'
timestamp('-1', 'ms')
// { ms: -1, seconds: -1, iso: '1969-12-31T23:59:59.999Z' }
timestamp('-1', 's').ms // -1000

Rounding milliseconds down to whole seconds loses precision. Converting -1ms to -1s and multiplying those whole seconds by 1000 gives -1000ms, not the original instant. Keep the millisecond value or a UTC string with .SSS when the source has millisecond precision.

Distinguish between seconds and milliseconds first

The reference point for Unix time is January 1, 1970, 00:00:00 UTC. In this tool, multiply the seconds value by 1000 to get the millisecond value. For example, the two numbers below represent the same moment. Since the unit is not automatically determined based on digits alone, check the unit description in the API or log format from which the number was received before selecting it.

1704067200 s
1704067200000 ms
2024-01-01T00:00:00.000Z

If you incorrectly select milliseconds for the seconds value above, you will get a date in 1970 instead of 2024. Even if there is no error message, the meaning may be incorrect. You should separately check whether the format is valid and when you intended it.

How to convert numbers and UTC dates

  1. Choose Number / Date and choose seconds or milliseconds.
  2. Enter an integer timestamp and press Convert.
  3. Check the results in UTC, device time, seconds, and milliseconds.
  4. For the reverse conversion, select UTC date / number and enter in YYYY-MM-DDTHH:mm:ss format. If you need milliseconds, prefix .SSS. The ending Z can be omitted and time zone offsets such as +09:00 are not supported.

The example date 2024-01-01T00:00:00 is interpreted as midnight UTC. If you want to enter midnight in Korean time, you must first consider the time difference from UTC. This tool does not have an optional feature to enter an arbitrary country time zone. If your device's time zone is set incorrectly, your device's time display may not be as expected.

Changing inputs or settings clears previous results. Changing the conversion direction or units does not automatically overwrite or convert the input. Click Insert Example to insert an example that matches the current direction and units. The first line of the conversion result corresponds to the selected direction and units, followed by UTC, device time zone name, seconds, and milliseconds.

Handling negative numbers, decimal points, and invalid dates

0 seconds is the reference point itself, -1 second is 1969-12-31T23:59:59.000Z. Numeric input does not accept decimal places. If you need 1.5 seconds, enter 1500 in milliseconds mode. The resulting seconds are milliseconds divided by 1000 and rounded down, so the integer second representation of -1 millisecond is -1.

In date input, dates that do not exist, such as February 30, are treated as errors. The supported range is from 0001 to 9999 and does not account for business days, holidays, legal deadlines, or leap seconds. If you just want to know the number of days between dates, a separate date calculator is simpler.

Official time representation specification: ECMAScript time values · How Date.parse interprets time zones

Frequently Asked Questions

What is the Z at the end of the UTC result?

In the ISO dates this tool outputs, Z represents UTC. Even if the number is the same, the time displayed on the screen may vary depending on the local time zone.

Is it automatically updated to the current time?

No. This is a tool that converts input values ​​into calculation buttons. The default example is a fixed date of 2024 and not the current time.