Nous.Tools.DateTimeTools (nous v0.13.3)
View SourceBuilt-in tools for date and time operations.
These tools provide common date/time functionality that AI agents often need:
- Get current date/time in various formats
- Parse and format dates
- Calculate date differences
- Check business days and weekends
- Timezone conversions
Usage
agent = Nous.new("lmstudio:qwen3-vl-4b-thinking-mlx",
tools: [
&DateTimeTools.current_date/2,
&DateTimeTools.current_time/2,
&DateTimeTools.current_datetime/2
]
)
{:ok, result} = Nous.run(agent, "What day is today?")
Summary
Functions
Add or subtract days from a date.
Get the current date in the specified format.
Get the current date and time together.
Get information about the current month.
Get the current time in the specified format.
Get the start and end of the current week.
Calculate the difference between two dates.
Get the day of the week for a given date.
Check if a date is a weekend.
Parse a human-readable date string.
Functions
Add or subtract days from a date.
Arguments
- date: Date in ISO8601 format (YYYY-MM-DD), defaults to today
- days: Number of days to add (positive) or subtract (negative)
Get the current date in the specified format.
Arguments
- format: "iso8601" (default), "us" (MM/DD/YYYY), "eu" (DD/MM/YYYY), "full" (Monday, January 1, 2025)
- timezone: Optional timezone (e.g., "America/New_York", "Europe/London", "UTC")
Get the current date and time together.
Arguments
- format: "iso8601" (default), "rfc3339", "unix", "human"
- timezone: Optional timezone
Get information about the current month.
Arguments
- timezone: Optional timezone
Get the current time in the specified format.
Arguments
- format: "24h" (default, HH:MM:SS), "12h" (hh:MM:SS AM/PM), "short" (HH:MM)
- timezone: Optional timezone
Get the start and end of the current week.
Arguments
- timezone: Optional timezone
- week_start: Day to consider start of week (1=Monday default, 7=Sunday)
Calculate the difference between two dates.
Arguments
- date1: First date in ISO8601 format (YYYY-MM-DD)
- date2: Second date in ISO8601 format (YYYY-MM-DD)
- unit: "days" (default), "weeks", "months", "years"
Get the day of the week for a given date.
Arguments
- date: Date in ISO8601 format (YYYY-MM-DD), defaults to today
Check if a date is a weekend.
Arguments
- date: Date in ISO8601 format (YYYY-MM-DD), defaults to today
Parse a human-readable date string.
Arguments
- date_string: Date in various formats (ISO8601, MM/DD/YYYY, DD/MM/YYYY, etc.)
- format: Expected format hint ("iso8601", "us", "eu")