Timestamps, dates, and time zones

Distinguish seconds, milliseconds, UTC, and local display.

Difficulty
beginner
Time
45 minutes
Last verified
9/21/2026

What you will build

Distinguish seconds, milliseconds, UTC, and local display.

Understand the idea first

Distinguish seconds, milliseconds, UTC, and local display.

Build it step by step

const seconds = 1760000000;
const date = new Date(seconds * 1000);
const local = new Intl.DateTimeFormat(undefined, {
  dateStyle: 'medium',
  timeStyle: 'short',
}).format(date);
console.log(date.toISOString(), local);
  1. Open the previous project and record its result.
  2. Type the example and complete: Format one instant as ISO, local time, and Asia/Shanghai; explain the difference.
  3. Change one input, predict, then verify.
  4. Create and repair: Unix seconds need ×1000; do not store a formatted display string.

Read the important lines

  • Distinguish seconds, milliseconds, UTC, and local display.
  • Read input, processing, and output separately.
  • Verify another input and an edge case.

Common mistakes and what to check

SymptomWhat to check
Unexpected resultUnix seconds need ×1000; do not store a formatted display string.
Nothing changesSave, verify paths, and read the first relevant Console error.

Practice without copying

Format one instant as ISO, local time, and Asia/Shanghai; explain the difference.

Check the answer after you try

Rebuild and explain the decisions. Check: Unix seconds need ×1000; do not store a formatted display string.

Completion check

  • I produced the required visible result
  • I can explain the input, processing, and output
  • I tested normal, edge, and failure cases

Your privacy choices

Necessary storage is always on. Optional analytics and support services load only after consent.