Home/Tools/tpmjs-datetime-tools

getCurrentDateTime

tpmjs-datetime-tools

Gets the current date and time in various formats and timezones

by lmwat

Official
utilities
v1.0.0
MIT
⚠️

This tool is currently broken

Import Failed
Cannot load from Railway service
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

Interactive Playground

Test tpmjs-datetime-tools (getCurrentDateTime) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install tpmjs-datetime-tools
pnpm add tpmjs-datetime-tools
yarn add tpmjs-datetime-tools
bun add tpmjs-datetime-tools
deno add npm:tpmjs-datetime-tools

2. Import the tool

import { getCurrentDateTime } from 'tpmjs-datetime-tools';

3. Use with AI SDK

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);

Parameters

Available configuration options

No schema

No schema available for this tool.

README

DateTime Tools for TPMJS

TPMJS tools for getting current date and time in various formats and timezones.

Installation

npm install @lmwat/datetime-tools

Tools

getCurrentDateTime

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 components
  • includeOffset (optional): Include timezone offset in response (default: false)

Returns:

  • success: Boolean indicating if the operation was successful
  • datetime: The formatted date/time string
  • timestamp: JavaScript timestamp (milliseconds since epoch)
  • unixTimestamp: Unix timestamp (seconds since epoch)
  • timezone: The timezone used
  • offset: 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.

Publishing to TPMJS

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.

License

MIT

Statistics

Downloads/month

98

GitHub Stars

0

Quality Score

53%

Bundle Size

NPM Keywords

tpmjs
datetime
time
date
utilities
timezone

Maintainers

davincidreams(lisamegawatts@gmail.com)