datetime-timezone-convert Edge Function — Utilities
UtilitiesConvert a datetime from one IANA timezone to another, returning the local time with UTC offset.
Edge function datetime-timezone-convert Convert a datetime from one IANA timezone to another, returning the local time with UTC offset.. Deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.
npx aerostack add navin/datetime-timezone-convert Use with AI Assistants
MCPConnect Claude, Cursor, or any MCP-compatible client — then call this function by slug
① Add MCP Server
Add this once — access all Aerostack functions from your AI tool.
{
"mcpServers": {
"aerostack": {
"url": "https://mcp.aerostack.dev",
"type": "http"
}
}
} ② Call this function
Ask your AI to use the call_function tool with this slug:
call_function({
slug: "datetime-timezone-convert",
args: {
"date": null,
"fromTimezone": "example_fromTimezone",
"toTimezone": "example_toTimezone"
}
}) datetime-timezone-convert — Convert datetimes between timezones
Convert any datetime between IANA timezones and get the local time with UTC offset.
API
POST /api/datetime-timezone-convert
Request body
| Field | Type | Required | Description |
|---|---|---|---|
date |
string | number |
✅ | Source date (ISO string or Unix ms) |
fromTimezone |
string |
✅ | Source IANA timezone |
toTimezone |
string |
✅ | Target IANA timezone |
Success response (200)
{
"success": true,
"data": {
"converted": "2024-01-15T05:00:00-05:00",
"formatted": "Mon, Jan 15, 2024, 05:00:00",
"offset": "-05:00",
"originalIso": "2024-01-15T10:00:00.000Z"
}
}
Usage
Direct import
import { datetimeTimezoneConvert } from '@aerostack/functions/datetime-timezone-convert';
const result = datetimeTimezoneConvert({
date: '2024-01-15T10:00:00Z',
fromTimezone: 'UTC',
toTimezone: 'Asia/Tokyo',
});
console.log(result.converted); // "2024-01-15T19:00:00+09:00"
Use Cases
- Displaying meeting times in user's local timezone
- Converting server UTC logs to a readable local time
- Building timezone-aware calendar and scheduling features
Metadata
Tags
Publisher
@navin verified
Build and publish your own functions
Write a TypeScript function, deploy it to the edge, and share it with thousands of developers — in minutes.
More Utilities Functions
Browse Utilities Functions →datetime-add
by @navin
Add or subtract a duration from a date, supporting units from milliseconds to years with correct month-end handling.
datetime-business-hours
by @navin
Check if a datetime falls within business hours and return the next opening time.
datetime-diff
by @navin
Calculate the difference between two dates in specified units (ms, seconds, minutes, hours, days, weeks, months, years).
datetime-duration-format
by @navin
Format a duration in milliseconds to a human-readable string with long, short, or compact styles.
datetime-format
by @navin
Format a date to a string using format tokens like YYYY-MM-DD HH:mm:ss with optional timezone support.
datetime-parse
by @navin
Parse a date string or unix timestamp to a normalised Unix millisecond timestamp and ISO string.
Frequently asked questions
What does the datetime-timezone-convert function do? +
datetime-timezone-convert is a serverless edge function for utilities automation written in aerostack. Deploy it to Cloudflare Workers via your Aerostack workspace.
How do I deploy the datetime-timezone-convert function? +
Install the Aerostack CLI and run: ```bash aerostack deploy function @navin/datetime-timezone-convert ``` It will be live on Cloudflare Workers in seconds.
What runtime does datetime-timezone-convert use? +
datetime-timezone-convert runs on aerostack on the Cloudflare Workers edge runtime — zero cold starts, globally distributed.
Can I customise the datetime-timezone-convert function? +
Yes. Fork the function from your Aerostack dashboard, modify the source, and redeploy. All changes are version-controlled.