Skip to main content

timeuntil

Like timesince, but return a string measuring the time until the given time.

def timeuntil(
d: datetime,
now: datetime = null,
time_strings: dict = null,
depth: integer = 2
) - > string

Like timesince, but return a string measuring the time until the given time.

Parameters

NameTypeDescription
ddatetimeThe future date and time to measure the interval towards.
nowdatetime = nullThe reference datetime to measure from; defaults to the current time if not provided.
time_stringsdict = nullOptional dictionary containing custom translations for time units like 'year', 'month', etc.
depthinteger = 2The number of adjacent time units to include in the returned string for greater precision.

Returns

TypeDescription
stringA localized string representing the time interval remaining until the specified date, such as "2 days, 4 hours".