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 Parametersstring
required
The time operation to perform. Must be one of:
now, parse, format, diffstring
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. Outputstring
RFC3339 formatted timestamp (ISO 8601)
integer
Unix timestamp in seconds since epoch
integer
Unix timestamp in milliseconds since epoch
parse
Parse an ISO 8601 timestamp string into multiple formats. Inputstring
required
ISO 8601 timestamp string to parse
string
RFC3339 formatted timestamp
integer
Unix timestamp in seconds
integer
Unix timestamp in milliseconds
InvalidParameters: Invalid timestamp format (must be ISO 8601)
diff
Calculate the time difference between two timestamps. Inputstring
required
First ISO 8601 timestamp (earlier time)
string
required
Second ISO 8601 timestamp (later time)
integer
Difference in seconds (timestamp2 - timestamp)
integer
Difference in minutes
integer
Difference in hours
integer
Difference in days
All durations are signed. If
timestamp2 is before timestamp, values will be negative.InvalidParameters: Invalid timestamp or timestamp2 format
Examples
Get Current Time
Parse Date String
Calculate Time Elapsed
Negative Difference
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 secondsminutes: Truncated to whole minuteshours: Truncated to whole hoursdays: Truncated to whole 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