DateTime
Standard · 1 creditParse date strings, convert between timezones, compute diffs, add durations, and count business days.
POST /api/datetime
Section titled “POST /api/datetime”Parameters
Section titled “Parameters”| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | parse, format, convert, diff, add, or business_days |
value | string | Yes | Date/time string or Unix timestamp |
value2 | string | No | Second date — required for diff and business_days |
timezone | string | No | IANA timezone for convert (e.g. America/New_York) |
duration | string | No | Go duration string for add (e.g. 72h, 30m, 24h30m) |
output_format | string | No | Go time format layout for format |
Response
Section titled “Response”| Field | Type | Description |
|---|---|---|
formatted | string | Formatted date string |
parsed | object | Parsed date components |
parsed.year | integer | Year |
parsed.month | integer | Month (1–12) |
parsed.day | integer | Day of month |
parsed.hour | integer | Hour (0–23) |
parsed.minute | integer | Minute |
parsed.second | integer | Second |
parsed.weekday | string | Day of week |
parsed.timezone | string | Timezone name |
parsed.unix_timestamp | integer | Unix timestamp |
parsed.iso8601 | string | ISO 8601 representation |
diff | object | Difference between two dates |
diff.days | integer | Days |
diff.hours | integer | Hours |
diff.minutes | integer | Minutes |
diff.seconds | integer | Seconds |
diff.human_readable | string | Human-readable duration |
business_days | integer | Business days between two dates |
Examples
Section titled “Examples”Parse a date
Section titled “Parse a date”curl -X POST https://morso.dev/api/datetime \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"action": "parse", "value": "2026-05-06T14:30:00Z"}'{ "parsed": { "year": 2026, "month": 5, "day": 6, "hour": 14, "minute": 30, "second": 0, "weekday": "Wednesday", "timezone": "UTC", "unix_timestamp": 1778346600, "iso8601": "2026-05-06T14:30:00Z" }}Convert timezone
Section titled “Convert timezone”curl -X POST https://morso.dev/api/datetime \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"action": "convert", "value": "2026-05-06T14:30:00Z", "timezone": "America/New_York"}'{ "formatted": "2026-05-06T10:30:00-04:00", "parsed": { "year": 2026, "month": 5, "day": 6, "hour": 10, "minute": 30, "second": 0, "weekday": "Wednesday", "timezone": "EDT", "unix_timestamp": 1778346600, "iso8601": "2026-05-06T10:30:00-04:00" }}Diff two dates
Section titled “Diff two dates”curl -X POST https://morso.dev/api/datetime \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"action": "diff", "value": "2026-01-01", "value2": "2026-05-06"}'{ "diff": { "days": 125, "hours": 3000, "minutes": 180000, "seconds": 10800000, "human_readable": "125 days" }}Business days
Section titled “Business days”curl -X POST https://morso.dev/api/datetime \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"action": "business_days", "value": "2026-05-01", "value2": "2026-05-15"}'{ "business_days": 10}