View Source Timex.Calendar.Julian (timex v3.7.11)
This module contains functions for working with dates in the Julian calendar.
Link to this section Summary
Functions
Given a Julian day of year, and a year, this function returns the
Date
which that day falls on.
Returns the day of the week, starting with 0 for Sunday, or 1 for Monday
Same as day_of_week/1, except takes year/month/day as distinct arguments
Returns the Julian day number for the given Erlang date (gregorian)
Same as julian_date/1, except takes year/month/day as distinct arguments
Same as julian_date/1, except takes year/month/day/hour/minute/second as distinct arguments
Link to this section Functions
Given a Julian day of year, and a year, this function returns the
Date
which that day falls on.
If no options are provided, leap days are disregarded, and the valid range for the day provided is 1-365, i.e. there is no representation for Feb 29.
To allow representing leap days, you may pass leaps: true
, which in
turn expands the range of the day provided to 0-365.
NOTE: This is internally used for POSIX-TZ support, but may be useful to others, so it is being made public.
@spec day_of_week(Timex.Types.date(), :sun | :mon) :: Timex.Types.weekday()
Returns the day of the week, starting with 0 for Sunday, or 1 for Monday
@spec day_of_week( Timex.Types.year(), Timex.Types.month(), Timex.Types.day(), :sun | :mon ) :: Timex.Types.weekday()
Same as day_of_week/1, except takes year/month/day as distinct arguments
@spec julian_date(Timex.Types.date()) :: integer()
@spec julian_date(Timex.Types.datetime()) :: integer()
Returns the Julian day number for the given Erlang date (gregorian)
The Julian date (JD) is a continuous count of days from 1 January 4713 BC (= -4712 January 1), Greenwich mean noon (= 12h UT). For example, AD 1978 January 1, 0h UT is JD 2443509.5 and AD 1978 July 21, 15h UT, is JD 2443711.125.
This algorithm assumes a proleptic Gregorian calendar (i.e. dates back to year 0), unlike the NASA or US Naval Observatory algorithm - however they align perfectly for dates back to October 15th, 1582, which is where it starts to differ, which is due to the fact that their algorithm assumes there is no Gregorian calendar before that date.
@spec julian_date(Timex.Types.year(), Timex.Types.month(), Timex.Types.day()) :: integer()
Same as julian_date/1, except takes year/month/day as distinct arguments
@spec julian_date( Timex.Types.year(), Timex.Types.month(), Timex.Types.day(), Timex.Types.hour(), Timex.Types.minute(), Timex.Types.second() ) :: float()
Same as julian_date/1, except takes year/month/day/hour/minute/second as distinct arguments