Skip to content

date

a moment in time

1
# date: a moment, made with date() or now
2
date("2026-12-25 18:30")2026-12-25 18:30:00 -06:00
3
# the current moment
4
now2026-11-04 12:12:41 -06:00
Example outputCtrl+Enter to run
1
# + or - a duration moves it
2
now + 2 days2026-11-06 12:12:41 -06:00
3
# to a time zone
4
now to "Tokyo"2026-11-05 03:12:41 +09:00
Example outputCtrl+Enter to run
  • year the year of a date
  • month the month of a date, from 1 for January to 12
  • day the day of the month, from 1 to 31
  • hour the hour of a date, from 0 to 23
  • minute the minute of a date, from 0 to 59
  • second the second of a date, from 0 to 59
  • weekday the name of the day of the week, like “Friday”
  • format a date as text laid out by strftime codes, such as %Y for the year, %m the month, %d the day, %H:%M the time and %B the month’s name
  • with the same date with some parts changed, given as a map of year, month, day, hour, minute and second, like {day: 1}
  • is_weekend whether the date is a Saturday or Sunday
  • is_weekday whether the date is Monday to Friday
  • is_today whether the date falls on today’s date
  • is_past whether the date is earlier than now
  • is_future whether the date is later than now
  • age how many whole years have passed since d, as for someone’s age from their birthday
  • diff the time from a to b in calendar terms
  • relative how far the date is from now, in words like “in 3 days” or “2 hours ago”
  • unix the Unix timestamp: seconds since the start of 1970 in UTC, the same as d to unix
  • unix_ms the Unix timestamp in milliseconds, the same as d to unix_ms
  • weekday_num the day of the week as a number, from 1 for Monday to 7 for Sunday
  • day_of_year which day of the year it is, from 1 to 366
  • iso_week the week number by the ISO standard used in Europe and business
  • week_num the week number when weeks start on first_day, where week 1 is the week with January 1
  • year_frac the length of time from a to b as a number of years, by a day-count basis
  • quarter which quarter of the year the date is in, 1 to 4
  • leap_year whether the year is a leap year
  • days_in_month how many days the date’s month has
  • days_in_year how many days the date’s year has, 365 or 366
  • start_of the first moment of the period the date is in
  • end_of the last moment of the period the date is in, with periods as for start_of
  • next the first date after d that falls on the given weekday, never d itself
  • prev the latest date before d that falls on the given weekday, never d itself
  • nth_weekday the nth given weekday in d’s month, like the 4th Thursday
  • add_workdays the date n business days later, counting only Monday to Friday and skipping holidays
  • workdays how many business days (Monday to Friday, less holidays) there are from a up to, but not including, b
  • calendar a month drawn as a calendar grid, weeks starting on Monday
  • zodiac the Western star sign for a birthday (today without one)
  • chinese_zodiac the Chinese zodiac element and animal for a year
  • hebrew the date in the Hebrew calendar, with months counted from Nisan, so Tishrei is 7
  • islamic the date in the Islamic (Hijri) calendar, by the arithmetic rules
  • persian the date in the Persian (Solar Hijri) calendar used in Iran and Afghanistan
  • julian the date in the Julian calendar, which Orthodox churches still use and which runs 13 days behind
  • coptic the date in the Coptic calendar of Egypt
  • ethiopian the date in the Ethiopian calendar
  • indian the date in the Indian national (Saka) calendar
  • jd the Julian day number: days since noon UTC on 1 January 4713 BC (Julian), with the time of day as a fraction
  • mjd the modified Julian day number, which is the Julian day minus 2400000.5, so days start at midnight
  • calendars_of the date in every calendar zil knows
  • utc the same moment in UTC, the zone with no offset that times are often stored in
  • local the same moment in your computer’s time zone, the same as d to local
  • moon_phase the moon’s phase on a day (today without one), like “full moon”, and how much of it is lit

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.