View Source Cldr.Calendar.Sigils (Cldr Calendars v1.26.1)

Implements the ~d sigils to produce dates, datetimes and naive datetimes.

Summary

Functions

Implements a ~d sigil for expressing dates.

Functions

Link to this macro

sigil_d(arg, modifiers)

View Source (macro)

Implements a ~d sigil for expressing dates.

Dates can be expressed in the following formats:

  • ~d[yyyy-mm-dd] which produces a date in the Cldr.Calendar.Gregorian calendar
  • ~d[yyyy-Wmm-dd] which produces a date in the Cldr.Calendar.ISOWeek calendar
  • ~d[yyyy-mm-dd calendar] which produces a date in the given month-based calendar
  • ~d[yyyy-Wmm-dd calendar] which produces a date in the given week-based calendar
  • ~d[yyyy-mm-dd C.E Julian] which produces a date in the Cldr.Calendar.Julian calendar
  • ~d[yyyy-mm-dd B.C.E Julian] which produces a date in the Cldr.Calendar.Julian calendar

Examples

iex> import Cldr.Calendar.Sigils
iex> ~d[2019-01-01 Gregorian]
~d[2019-01-01 Gregorian]
iex> ~d[2019-W01-01]
~d[2019-W01-1 ISOWeek]