tpmjs-datetime-tools
Gets the current date and time in various formats and timezones
by lmwat
Tool "getCurrentDateTime" has no valid inputSchema. Tools must use AI SDK jsonSchema(), Zod v4 (._zod), or Zod v3 (._def) schemas.
Last checked: 2/28/2026, 4:01:45 AM
Test tpmjs-datetime-tools (getCurrentDateTime) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install tpmjs-datetime-toolspnpm add tpmjs-datetime-toolsyarn add tpmjs-datetime-toolsbun add tpmjs-datetime-toolsdeno add npm:tpmjs-datetime-toolsimport { getCurrentDateTime } from 'tpmjs-datetime-tools';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { getCurrentDateTime } from 'tpmjs-datetime-tools';
const result = await generateText({
model: openai('gpt-4o'),
tools: { getCurrentDateTime },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
No schema available for this tool.
TPMJS tools for getting current date and time in various formats and timezones.
npm install @lmwat/datetime-tools
Gets the current date and time in various formats and timezones.
Parameters:
timezone (optional): Timezone string (e.g., "America/New_York", "Europe/London", "Asia/Tokyo", "UTC"). Defaults to system timezone.format (optional): Output format:
"iso": ISO 8601 format (default)"locale": Localized string format"unix": Unix timestamp (seconds since epoch)"custom": Detailed breakdown with date componentsincludeOffset (optional): Include timezone offset in response (default: false)Returns:
success: Boolean indicating if the operation was successfuldatetime: The formatted date/time stringtimestamp: JavaScript timestamp (milliseconds since epoch)unixTimestamp: Unix timestamp (seconds since epoch)timezone: The timezone usedoffset: Timezone offset (if includeOffset is true)components: Detailed date components (only when format is "custom")Example Usage:
import { getCurrentDateTime } from '@lmwat/datetime-tools'; // Get current time in ISO format const result1 = await getCurrentDateTime.execute({}); // Returns: { success: true, datetime: "2026-02-13T10:30:00.000Z", ... } // Get current time in New York timezone const result2 = await getCurrentDateTime.execute({ timezone: 'America/New_York', format: 'locale' }); // Returns: { success: true, datetime: "2/13/2026, 5:30:00 AM", ... } // Get detailed breakdown with timezone offset const result3 = await getCurrentDateTime.execute({ format: 'custom', includeOffset: true }); // Returns detailed components including year, month, day, hour, etc.
This tool is designed to be published to TPMJS, where it will be automatically indexed and made available for AI agents to use.
After publishing to npm, your tool will appear on tpmjs.com within 15 minutes.
MIT
Downloads/month
98
GitHub Stars
0
Quality Score