Search
ctrl/
Ask AI
Light
Dark
System

Scalars

Subtopics

EdgeDB offers another group of built-in types for dealing with date and time representation. They are part of the cal module — cal meaning "calendar" — and they are all timezone unaware — just like your wall clock or calendar: a date and/or time without anything about its timezone.

You can represent a time with local_time, a date with local_date, or both with local_datetime. You can use them to represent alarms, holiday dates, or even regular business hours — things like "Pi Day" (March 14th) or "alarm at 8:30am."

Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input

The section on casting took a quick look at the duration type, used when you need to specify more than just a single point in time.

Another way to specify durations is in relative terms such as months, days, and hours. Relative values are not absolute like duration, because not all months have the same number of days and not all days have the same number of seconds. The two types used to specify relative durations are relative_duration and date_duration.

What makes date_duration different from relative_duration is the granularity. Whereas relative_duration can be specified in units all the way down to microseconds, date_duration cannot be specified in units smaller than a day. They are analogous to float64 and int64 in that way.

Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input