48 lines
1.6 KiB
Markdown
48 lines
1.6 KiB
Markdown
---
|
|
epic: 4
|
|
story: 4.5
|
|
title: "Unix Timestamp Conversions"
|
|
status: draft
|
|
---
|
|
|
|
## Epic 4 — Date, Time & Time Zones
|
|
**Goal:** Full date/time math, business day calculations, and timezone awareness.
|
|
|
|
### Story 4.5: Unix Timestamp Conversions
|
|
|
|
As a CalcPad user (particularly a developer),
|
|
I want to convert between Unix timestamps and human-readable dates,
|
|
So that I can debug timestamps in logs and APIs.
|
|
|
|
**Acceptance Criteria:**
|
|
|
|
**Given** the expression `1733823083 to date`
|
|
**When** the engine evaluates it
|
|
**Then** it recognizes the number as a Unix timestamp (seconds since epoch)
|
|
**And** returns the corresponding date and time in the user's local timezone
|
|
|
|
**Given** the expression `1733823083000 to date`
|
|
**When** the engine evaluates it
|
|
**Then** it recognizes the 13-digit number as a millisecond Unix timestamp
|
|
**And** returns the corresponding date and time
|
|
|
|
**Given** the expression `now to unix`
|
|
**When** the engine evaluates it
|
|
**Then** it returns the current Unix timestamp in seconds
|
|
|
|
**Given** the expression `January 1, 2025 to unix`
|
|
**When** the engine evaluates it
|
|
**Then** it returns the Unix timestamp `1735689600` (midnight UTC on that date)
|
|
|
|
**Given** the expression `0 to date`
|
|
**When** the engine evaluates it
|
|
**Then** it returns `January 1, 1970 00:00:00 UTC` (the Unix epoch)
|
|
|
|
**Given** a negative timestamp such as `-86400 to date`
|
|
**When** the engine evaluates it
|
|
**Then** it returns `December 31, 1969` (one day before the epoch)
|
|
|
|
**Given** the expression `1733823083 to date in Tokyo`
|
|
**When** the engine evaluates it
|
|
**Then** it converts the timestamp and displays the result in Asia/Tokyo timezone
|