Reference · Dates

date.date_in

signature
date.date_in(str, str | null=) -> str

What it does

The calendar date of a date-time in a time zone: what day it is there at that instant, as ISO text "YYYY-MM-DD". The zone is an IANA name (see date.valid_zone), "UTC" or an offset like "+05:30" or "+0530"; left out, it is UTC. It is also the way from a date-time to a date for the functions that take only dates (date.add_days, date.days_between and the rest).

Examples

print(date.date_in("2026-10-27T23:30:00Z", "Asia/Tokyo"), date.date_in("2026-10-27T03:30:00Z", "America/Los_Angeles"))print(date.date_in("2026-10-27T23:30:00Z"))print(date.date_in("2026-10-27T15:30:00+01:00") | date.add_days(1))
output
2026-10-28 2026-10-262026-10-272026-10-28

Edge cases

print(date.date_in("2026-10-27T00:30:00+02:00"), date.date_in("2026-10-27T00:30:00+02:00", "+02:00"))print(date.date_in("2026-10-27T23:30:00Z", "+01:00"), date.date_in("2026-07-01T22:30:00Z", "Europe/Paris"))
output
2026-10-26 2026-10-272026-10-28 2026-07-02

Errors

A date instead of a date-time, text that is neither, or an unknown zone is a runtime error, not an error value.

this one fails
print(date.date_in("2026-10-27", "UTC"))
output
line 1: `date.date_in` expects a date-time (like 2026-10-27T14:30:00Z) as argument 1, got "2026-10-27"
this one fails
print(date.date_in("2026-10-27T14:30:00Z", "Paris"))
output
line 1: `date.date_in`: unknown time zone "Paris"

Chaining

print("2026-10-27T23:30:00Z" | date.date_in("Asia/Tokyo") | date.weekday)print(date.from_ms(1793111400000) | date.date_in("Pacific/Auckland") | date.format({ locale: "en-NZ", style: "full" }))
output
3Wednesday, 28 October 2026

See also

date.to_zone, date.at, date.today, date.add_days, date.parts

Thread
8Useful? Like it, or add to its thread below.

Thread 0 posts

On date.date_in(): questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.

    Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo