getDateByTimestamp
Transform numeric timestamps into readable date formats using this tool on Cal Server, simplifying time-based data conversion.
Instructions
Convert the provided timestamp to date format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ts | Yes |
Implementation Reference
- index.ts:32-34 (handler)Handler function that executes the tool logic by calling getDateByTimestamp on the input ts and returning it as a string.execute: async (args) => { return String(getDateByTimestamp(args.ts)); },
- index.ts:29-31 (schema)Zod schema defining the input parameter 'ts' as a number.parameters: z.object({ ts: z.number(), }),
- index.ts:26-35 (registration)Registration of the 'getDateByTimestamp' tool with FastMCP server, including name, description, schema, and handler.server.addTool({ name: "getDateByTimestamp", description: "Convert the provided timestamp to date format", parameters: z.object({ ts: z.number(), }), execute: async (args) => { return String(getDateByTimestamp(args.ts)); }, });
- index.ts:71-73 (helper)Helper function implementing the core logic: converts a Unix timestamp (number) to a locale-formatted date string.function getDateByTimestamp(ts: number) { return new Date(ts).toLocaleString() }