Skip to main content

Overview

The time tool provides operations for getting current time, parsing timestamps, formatting dates, and calculating time differences.

time

Get current time, convert timezones, or calculate time differences. Input Parameters
string
required
The time operation to perform. Must be one of: now, parse, format, diff
string
ISO 8601 timestamp for parse/format/diff operations
string
Output format string (for format operation)
string
Second timestamp for diff operation

Operations

now

Get the current UTC time. Input No additional parameters required. Output
string
RFC3339 formatted timestamp (ISO 8601)
integer
Unix timestamp in seconds since epoch
integer
Unix timestamp in milliseconds since epoch
Example
Response

parse

Parse an ISO 8601 timestamp string into multiple formats. Input
string
required
ISO 8601 timestamp string to parse
Output
string
RFC3339 formatted timestamp
integer
Unix timestamp in seconds
integer
Unix timestamp in milliseconds
Example
Response
Error Conditions
  • InvalidParameters: Invalid timestamp format (must be ISO 8601)

diff

Calculate the time difference between two timestamps. Input
string
required
First ISO 8601 timestamp (earlier time)
string
required
Second ISO 8601 timestamp (later time)
Output
integer
Difference in seconds (timestamp2 - timestamp)
integer
Difference in minutes
integer
Difference in hours
integer
Difference in days
Example
Response
All durations are signed. If timestamp2 is before timestamp, values will be negative.
Error Conditions
  • InvalidParameters: Invalid timestamp or timestamp2 format

Examples

Get Current Time

Parse Date String

Response:

Calculate Time Elapsed

Response:

Negative Difference

Response:

Use Cases

Log Timestamping

Get current time for log entries:

Duration Tracking

Calculate how long a task took:

Deadline Checking

Calculate days until deadline:

Parse External Timestamps

Convert timestamps from APIs or logs:

Technical Details

Timezone Handling

All timestamps are normalized to UTC. Input timestamps with timezone offsets (e.g., -05:00) are converted to UTC for comparison and output.

ISO 8601 Format

Accepted timestamp formats:
  • 2024-01-15T14:30:00Z (UTC)
  • 2024-01-15T14:30:00+00:00 (UTC with offset)
  • 2024-01-15T09:30:00-05:00 (with timezone offset)
  • 2024-01-15T14:30:00.123Z (with milliseconds)

Duration Precision

  • seconds: Exact duration in seconds
  • minutes: Truncated to whole minutes
  • hours: Truncated to whole hours
  • days: Truncated to whole days
Example: 25.5 hours = 25 hours, 0 days

Sanitization

No sanitization required - internal tool with no external data access.

Approval

No approval required - safe internal operation.

Error Handling

  • Unknown operation
  • Missing required timestamp parameter
  • Invalid ISO 8601 timestamp format