@@ -5,7 +5,7 @@ DocTestSetup = :(using Dates)
5
5
```
6
6
7
7
The ` Dates ` module provides three types for representing dates and times:
8
- [ ` Date ` ] ( @ref ) , [ ` DateTime ` ] ( @ref ) , and [ ` Time ` ] ( @ref ) representing
8
+ [ ` Date ` ] ( @ref ) , [ ` DateTime ` ] ( @ref ) , and [ ` Time ` ] ( @ref ) measured with
9
9
day, millisecond and nanosecond precision, respectively;
10
10
all are subtypes of the abstract [ ` TimeType ` ] ( @ref ) .
11
11
The motivation for distinct types is simple: some operations are much simpler, both in terms of
@@ -29,8 +29,10 @@ The ISO standard, however, states that 1 BC/BCE is year zero, so `0000-12-31` is
29
29
BC/BCE, etc.
30
30
31
31
The [ ` Time ` ] ( @ref ) is also an immutable [ ` Int64 ` ] ( @ref ) wrapper, also based on the UT second [ ^ 1 ] ,
32
- but constrained to represent the periodic (cyclic) time of the 24-hour day starting at midnight.
33
- Note that midnight is represented as 0 hour. 24 hour is out of range.
32
+ and represents the time of day according to the conventional 24-hour clock, starting at midnight,
33
+ and ending the instant one nanosecond prior to midnight. Time is periodic, and wraps around at
34
+ midnight (see [ TimeType-Period arithmetic] ( #TimeType-Period-Arithmetic ) ).
35
+
34
36
35
37
[ ^ 1 ] :
36
38
The notion of the UT second is actually quite fundamental. There are basically two different notions
@@ -45,7 +47,7 @@ Note that midnight is represented as 0 hour. 24 hour is out of range.
45
47
46
48
## Constructors
47
49
48
- [ ` Date ` ] ( @ref ) and [ ` DateTime ` ] ( @ref ) types can be constructed by integer or [ ` Period ` ] ( @ref )
50
+ [ ` Date ` ] ( @ref ) , [ ` DateTime ` ] ( @ref ) and [ ` Time ` ] ( @ref ) types can be constructed by integer or [ ` Period ` ] ( @ref )
49
51
types, by parsing, or through adjusters (more on those later):
50
52
51
53
``` jldoctest
@@ -84,6 +86,16 @@ julia> Date(Dates.Year(2013),Dates.Month(7),Dates.Day(1))
84
86
85
87
julia> Date(Dates.Month(7),Dates.Year(2013))
86
88
2013-07-01
89
+
90
+ julia> Time(12)
91
+ 12:00:00
92
+
93
+ julia> Time(12, 30, 59, 1, 0, 2)
94
+ 12:30:59.001000002
95
+
96
+ julia> Time(Hour(12), Minute(30), Second(59), Millisecond(1), Nanosecond(2))
97
+ 12:30:59.001000002
98
+
87
99
```
88
100
89
101
[ ` Date ` ] ( @ref ) or [ ` DateTime ` ] ( @ref ) parsing is accomplished by the use of format strings. Format
@@ -463,6 +475,13 @@ julia> collect(dr)
463
475
2014-05-29
464
476
2014-06-29
465
477
2014-07-29
478
+ ```
479
+
480
+ Time is periodic, and wraps around at midnight:
481
+
482
+ ``` jldoctest
483
+ julia> Time(23) + Hour(1)
484
+ 00:00:00
466
485
467
486
julia> r = range(Time(0), step = Hour(9), length = 5)
468
487
Time(0):Hour(9):Time(12)
0 commit comments