tpmjs-datetime-tools
v1.0.0
Published
TPMJS tools for getting current date and time in various formats and timezones
Maintainers
Readme
DateTime Tools for TPMJS
TPMJS tools for getting current date and time in various formats and timezones.
Installation
npm install @lmwat/datetime-toolsTools
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 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.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
