A timezone-aware date and time tool. Use it to:
- get the current time in any IANA timezone (
now) - parse an ISO 8601 datetime string into structured fields (
parse) - convert a datetime from one timezone to another (
convert) - shift a datetime by days/hours/minutes/seconds (
shift) - compute the difference between two datetimes (
diff)
It uses the standard library only (datetime, zoneinfo) plus tzdata so the tool also works on Windows where the OS does not ship the IANA timezone database.
- Python 3.12 or later
atomic-agentspydantictzdata
- Using the Atomic Assembler CLI: run
atomicand selectdatetime_tool. - Or copy the
tool/folder directly into your project.
operation(Literal): one ofnow,parse,convert,shift,diff.timezone(str): IANA timezone name. Defaults toUTC. Forconvertthis is the source timezone ofinput.target_timezone(str, optional): required forconvert.input(str, optional): ISO 8601 datetime string for non-nowoperations.input_2(str, optional): second datetime, required fordiff(computesinput_2 - input).days,hours,minutes,seconds(int): duration components forshift(negative values subtract).
operation(str): operation that was performed.iso,timezone,unix_timestamp,year,month,day,hour,minute,second,weekday,human: populated fornow/parse/convert/shift.diff_seconds,diff_human: populated fordiff.error(str, optional): set when something went wrong.
from tool.datetime_tool import DateTimeTool, DateTimeToolInputSchema
tool = DateTimeTool()
# Current time in Tokyo
print(tool.run(DateTimeToolInputSchema(operation="now", timezone="Asia/Tokyo")))
# Convert a Brussels meeting time to New York
print(tool.run(DateTimeToolInputSchema(
operation="convert",
input="2026-04-29T15:30:00",
timezone="Europe/Brussels",
target_timezone="America/New_York",
)))PRs welcome — see the main repo CONTRIBUTING.md.
Same as the main Atomic Agents project.