View Source Timex.Calendar.Julian (timex v3.7.9)

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

Link to this function

date_for_day_of_year(day, year, opts \\ [])

View Source

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.

Link to this function

day_of_week(arg, weekstart)

View Source
@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

Link to this function

day_of_week(year, month, day, weekstart)

View Source
@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.

Link to this function

julian_date(year, month, day)

View Source
@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

Link to this function

julian_date(year, month, day, hour, minute, second)

View Source

Same as julian_date/1, except takes year/month/day/hour/minute/second as distinct arguments