-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
/
Dates.jl
84 lines (70 loc) · 2.58 KB
/
Dates.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# This file is a part of Julia. License is MIT: https://julialang.org/license
"""
Dates
The `Dates` module provides `Date`, `DateTime`, `Time` types, and related functions.
The types are not aware of time zones, based on UT seconds
(86400 seconds a day, avoiding leap seconds), and
use the proleptic Gregorian calendar, as specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601).
For time zone functionality, see the TimeZones.jl package.
```jldoctest
julia> dt = DateTime(2017,12,31,23,59,59,999)
2017-12-31T23:59:59.999
julia> d1 = Date(Dates.Month(12), Dates.Year(2017))
2017-12-01
julia> d2 = Date("2017-12-31", Dates.DateFormat("y-m-d"))
2017-12-31
julia> Dates.yearmonthday(d2)
(2017, 12, 31)
julia> d2-d1
30 days
```
Please see the manual section on [`Date`](@ref) and [`DateTime`](@ref)
for more information.
"""
module Dates
import ..Base: ==, div, fld, mod, rem, gcd, lcm, +, -, *, /, %
import ..Base.broadcast
using Base.Iterators
using Base.@nospecialize
include("types.jl")
include("periods.jl")
include("accessors.jl")
include("query.jl")
include("arithmetic.jl")
include("conversions.jl")
include("ranges.jl")
include("adjusters.jl")
include("rounding.jl")
include("io.jl")
include("parse.jl")
export Period, DatePeriod, TimePeriod,
Year, Month, Week, Day, Hour, Minute, Second, Millisecond,
Microsecond, Nanosecond,
TimeZone, UTC, TimeType, DateTime, Date, Time,
# periods.jl
canonicalize,
# accessors.jl
yearmonthday, yearmonth, monthday, year, month, week, day,
hour, minute, second, millisecond, dayofmonth,
microsecond, nanosecond,
# query.jl
dayofweek, isleapyear, daysinmonth, daysinyear, dayofyear, dayname, dayabbr,
dayofweekofmonth, daysofweekinmonth, monthname, monthabbr,
quarterofyear, dayofquarter,
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday,
Mon, Tue, Wed, Thu, Fri, Sat, Sun,
January, February, March, April, May, June,
July, August, September, October, November, December,
Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec,
# conversions.jl
unix2datetime, datetime2unix, now, today,
rata2datetime, datetime2rata, julian2datetime, datetime2julian,
# adjusters.jl
firstdayofweek, lastdayofweek,
firstdayofmonth, lastdayofmonth,
firstdayofyear, lastdayofyear,
firstdayofquarter, lastdayofquarter,
adjust, tonext, toprev, tofirst, tolast,
# io.jl
ISODateTimeFormat, ISODateFormat, ISOTimeFormat, DateFormat, RFC1123Format, @dateformat_str
end # module