Skip to content

Datetime

Liam Riddell edited this page Sep 9, 2023 · 2 revisions

Journey through the river of time with the Datetime Provider! Explore specialized functions that bring the abstract essence of time right at your fingertips.

Basic Expressions 🎲

In the intricate dance with time, use these expressions to choreograph your sequence:

  • Addition: Adding a span to a moment.
  • Subtraction: Take away time, but not experiences.
  • Time Until Date: Count down to special moments.
  • Time Since Date: Relive the moments that made history.
  • Primitive: The fundamental pieces of the temporal puzzle.

Addition βž•

Add a sprinkle of timespan to your special dates.

  • Syntax: Primitive add Timespan

Example

// Adding a Timespan to Now
now add 3 days

Subtraction βž–

Rewind the clock or leap into the future.

  • Syntax: Primitive subtract Timespan

Example

// Rolling back time
today subtract 1 week

Primitive Moments ⏰

Capture raw instances of time, both specific and relative.

  • Now: This very moment. now
  • Today: The present day. today
  • Tomorrow: A glimpse into the future. tomorrow
  • Yesterday: A blast from the recent past. yesterday
  • NextDayOfWeek: Eager for the weekend? Use next Saturday.
  • LastDayOfWeek: Nostalgic about the start of the week? Think last Monday.

TimeUnitUntilDate & TimeUnitSinceDate πŸ”„

Evoke the excitement of counting down or the sentiment of counting the moments since a day.

  • Syntax: (year | month | week | day) until Datetime
  • Syntax: (year | month | week | day) since Datetime

Example

// Days left until a special date
days until 25/12/23

// Time since a momentous occasion
1 year since 1/1/22

Datetime Formats πŸ“…

Capture the essence of time in various styles.

  • ISO 8601: Universal and precise. YYYY-MM-DDTHH:MM:SS
  • European/US: A blend of cultures. DD/MM/YYYY or MM-DD-YYYY or DD.MM.YYYY

Example

// ISO 8601
2023-09-09T12:30:00

// European Style
9/9/23 12:30

Timespan πŸ”„

Navigate the expanse of time, from milliseconds to years.

  • Syntax: number unitsOfTime

Example

// Span of time
2 weeks