Weekday (Calendars v0.2.4) View Source
The Weekday calendar module.
This is a cyclical calendar. So it is not possible to convert a 'date' of this calendar into a corresponding date of a monotonic or another cyclical calendar.
Link to this section Summary
Functions
Returns a fixed day or Weekday date as a Weekday date.
Returns a Weekday date from its fields day.
Returns the day field of a Weekday date.
Returns the name of the field atom in a Weekday date at field_index.
Returns a list of the field atoms (names) of a Weekday date.
Returns the number of fields in a Weekday date
Returns the index (= position) of the field_atom in a Weekday date.
Returns the weekday friday of the Weekday calendar.
Converts the other_date of the other_calendar into the equivalent date of the Weekday calendar.
Converts a fixed day to a Weekday date.
Converts a Julian Day into the equivalent Weekday date.
Converts a RataDie date into the equivalent Weekday date.
Converts a Unix date into the equivalent Weekday date.
Returns the internal keyword of the Weekday calendar.
Returns the module of the Weekday calendar.
Returns the weekday monday of the Weekday calendar.
Returns the internal name of the Weekday calendar.
Returns the weekday saturday of the Weekday calendar.
Returns the weekday sunday of the Weekday calendar.
Returns the weekday thursday of the Weekday calendar.
Returns the weekday tuesday of the Weekday calendar.
Returns the weekday wednesday of the Weekday calendar.
Returns a list of the weekdays of the Weekday calendar.
Link to this section Types
Specs
fixed() :: integer()
Specs
t() :: weekday_date()
Specs
weekday_date() :: {weekday_day()}
Specs
weekday_day() :: 0..6
Link to this section Functions
Specs
as_date(fixed() | weekday_date()) :: weekday_date()
Returns a fixed day or Weekday date as a Weekday date.
This is a convenience function to simplify certain function calls.
Examples
iex>Elixir.Weekday.as_date(730739)
{2}
iex>Elixir.Weekday.as_date({2})
{2} Specs
date(weekday_day()) :: t()
Returns a Weekday date from its fields day.
Example
iex>Elixir.Weekday.date(2)
{2} Specs
day(fixed() | weekday_date(), :atom | :index | :name | :value) :: :atom | integer() | String.t() | number()
Returns the day field of a Weekday date.
The type parameter determines the type of the returned day:
:atomreturns the internal name of day,:indexreturns the position of the day field within the date,:namereturns the common name of the day,:valuereturns the value of the day (default).
Examples
iex>Elixir.Weekday.day(730739)
2
iex>Elixir.Weekday.day(730739, :atom)
:day
iex>Elixir.Weekday.day(730739, :index)
0
iex>Elixir.Weekday.day(730739, :name)
"Day"
iex>Elixir.Weekday.day(730739, :value)
2
iex>Elixir.Weekday.day({2})
2
iex>Elixir.Weekday.day({2}, :atom)
:day
iex>Elixir.Weekday.day({2}, :index)
0
iex>Elixir.Weekday.day({2}, :name)
"Day"
iex>Elixir.Weekday.day({2}, :value)
2 Specs
Returns the name of the field atom in a Weekday date at field_index.
Example
iex>Elixir.Weekday.field_atom(0)
:day Specs
field_atoms() :: [atom()]
Returns a list of the field atoms (names) of a Weekday date.
Example
iex>Elixir.Weekday.field_atoms()
[:day] Specs
field_count() :: integer()
Returns the number of fields in a Weekday date
Example
iex>Elixir.Weekday.field_count()
1 Specs
Returns the index (= position) of the field_atom in a Weekday date.
Example
iex>Elixir.Weekday.field_index(:day)
0 Specs
friday(:integer | :name) :: integer()
Returns the weekday friday of the Weekday calendar.
The type parameter determines the type of the returned weekday:
:integerreturns the number of the weekday (default),:namereturns the name of the weekday.
Examples
iex>Elixir.Weekday.friday()
5
iex>Elixir.Weekday.friday(:integer)
5
iex>Elixir.Weekday.friday(:name)
"Friday" Specs
Converts the other_date of the other_calendar into the equivalent date of the Weekday calendar.
Example
iex>Elixir.Weekday.from_date({2001, 9, 11}, Gregorian)
{2} Specs
from_fixed(fixed()) :: weekday_date()
Converts a fixed day to a Weekday date.
Example
iex>Elixir.Weekday.from_fixed(730739)
{2} Specs
from_jd(tuple() | number()) :: weekday_date()
Converts a Julian Day into the equivalent Weekday date.
The Julian Day can be given as a tuple or by a Julian day.
Examples
iex>Elixir.Weekday.from_jd({2452163.5})
{2}
iex>Elixir.Weekday.from_jd(2452163.5)
{2} Specs
from_rata_die(tuple() | integer()) :: weekday_date()
Converts a RataDie date into the equivalent Weekday date.
The RataDie date can be given as a tuple or by a RataDie rd.
Examples
iex>Elixir.Weekday.from_rata_die({730739})
{2}
iex>Elixir.Weekday.from_rata_die(730739)
{2} Specs
from_unix(tuple() | integer()) :: weekday_date()
Converts a Unix date into the equivalent Weekday date.
The Unix date can be given as a tuple or by Unix seconds.
Examples
iex>Elixir.Weekday.from_unix({1000166400})
{2}
iex>Elixir.Weekday.from_unix(1000166400)
{2} Specs
keyword() :: atom()
Returns the internal keyword of the Weekday calendar.
Example
iex>Elixir.Weekday.keyword()
:weekday Specs
module() :: module()
Returns the module of the Weekday calendar.
Example
iex>Elixir.Weekday.module()
Weekday Specs
monday(:integer | :name) :: integer()
Returns the weekday monday of the Weekday calendar.
The type parameter determines the type of the returned weekday:
:integerreturns the number of the weekday (default),:namereturns the name of the weekday.
Examples
iex>Elixir.Weekday.monday()
1
iex>Elixir.Weekday.monday(:integer)
1
iex>Elixir.Weekday.monday(:name)
"Monday" Specs
name() :: atom()
Returns the internal name of the Weekday calendar.
Example
iex>Elixir.Weekday.name()
"Weekday" Specs
saturday(:integer | :name) :: integer()
Returns the weekday saturday of the Weekday calendar.
The type parameter determines the type of the returned weekday:
:integerreturns the number of the weekday (default),:namereturns the name of the weekday.
Examples
iex>Elixir.Weekday.saturday()
6
iex>Elixir.Weekday.saturday(:integer)
6
iex>Elixir.Weekday.saturday(:name)
"Saturday" Specs
sunday(:integer | :name) :: integer()
Returns the weekday sunday of the Weekday calendar.
The type parameter determines the type of the returned weekday:
:integerreturns the number of the weekday (default),:namereturns the name of the weekday.
Examples
iex>Elixir.Weekday.sunday()
0
iex>Elixir.Weekday.sunday(:integer)
0
iex>Elixir.Weekday.sunday(:name)
"Sunday" Specs
thursday(:integer | :name) :: integer()
Returns the weekday thursday of the Weekday calendar.
The type parameter determines the type of the returned weekday:
:integerreturns the number of the weekday (default),:namereturns the name of the weekday.
Examples
iex>Elixir.Weekday.thursday()
4
iex>Elixir.Weekday.thursday(:integer)
4
iex>Elixir.Weekday.thursday(:name)
"Thursday" Specs
tuesday(:integer | :name) :: integer()
Returns the weekday tuesday of the Weekday calendar.
The type parameter determines the type of the returned weekday:
:integerreturns the number of the weekday (default),:namereturns the name of the weekday.
Examples
iex>Elixir.Weekday.tuesday()
2
iex>Elixir.Weekday.tuesday(:integer)
2
iex>Elixir.Weekday.tuesday(:name)
"Tuesday" Specs
wednesday(:integer | :name) :: integer()
Returns the weekday wednesday of the Weekday calendar.
The type parameter determines the type of the returned weekday:
:integerreturns the number of the weekday (default),:namereturns the name of the weekday.
Examples
iex>Elixir.Weekday.wednesday()
3
iex>Elixir.Weekday.wednesday(:integer)
3
iex>Elixir.Weekday.wednesday(:name)
"Wednesday" Returns a list of the weekdays of the Weekday calendar.
The type parameter determines the type of the returned weekdays:
:integerreturns the numbers of the weekdays,:atomreturns the internal names of the weekdays,:namereturns the common names of the weekdays (default).
Examples
iex>Elixir.Weekday.weekdays()
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
iex>Elixir.Weekday.weekdays(:integer)
[0, 1, 2, 3, 4, 5, 6]
iex>Elixir.Weekday.weekdays(:atom)
[:sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday]
iex>Elixir.Weekday.weekdays(:name)
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]