Aerostack
build

datetime-timezone-convert Edge Function — Utilities

Utilities

Convert a datetime from one IANA timezone to another, returning the local time with UTC offset.

navin @navin verified
Updated Mar 12, 2026
GitHub

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.

terminal — aerostack cli
$ npx aerostack add navin/datetime-timezone-convert
smart_toy

Use with AI Assistants

MCP

Connect 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.

claude_desktop_config.json
{
  "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
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

upgrade Version 1.0.0
gavel License MIT
language Language typescript
cloud Provider aerostack

Tags

datetime
deployed_code

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 →

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.