MonthlyDates.jl

Author matthieugomez
Popularity
7 Stars
Updated Last
1 Year Ago
Started In
April 2020

Build status

MonthlyDates.jl

This packages makes it easier to work with monthly or quarterly dates. It defines two types:

  • A MonthlyDate <: TimeType type

     julia> using Dates, MonthlyDates
     julia> dt = MonthlyDate(1990, 1)
     # Alternatively, construct from a date
     julia> dtm = MonthlyDate(Date(1990, 1))
     # Alternatively, contruct from a string with default dateformat"yyyy-mm"
     julia> dtm = MonthlyDate("1990-01")
     # or any other DateFormat
     julia> dtm = MonthlyDate("1990/01", "yyyy/mm")
     # Arithmetic works as expected
     julia> dtm + Month(1)
     julia> Date(dtm)
     # 1990-01-01
    
  • A QuarterlyDate <: TimeType type (for Julia v1.6 and above)

     julia> using Dates, MonthlyDates
     julia> dtq = QuarterlyDate(1990, 1)
     # Alternatively, construct from a date
     julia> dtq = QuarterlyDate(Date(1990, 1))
     # Alternatively, contruct from a string with default dateformat"yyyy-Qq"
     julia> dtq = QuarterlyDate("1990-Q1") 
     # or any other DateFormat
     julia> dtq = QuarterlyDate("1990/04", "yyyy/mm")
     # Arithmetic works as expected
     julia> dtq + Quarter(3)
     julia> Date(dtq)
     # 1990-04-01

Please open an issue or submit a pull request if you need more methods to be defined.

Required Packages

Used By Packages

No packages found.