Skip to content

Commit

Permalink
updated some docs for issue JuliaLang#31202
Browse files Browse the repository at this point in the history
  • Loading branch information
jch8ri committed May 6, 2019
1 parent 040a3e5 commit 7081354
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stdlib/Dates/src/Dates.jl
Expand Up @@ -50,7 +50,8 @@ include("io.jl")
include("parse.jl")
include("deprecated.jl")

export Period, DatePeriod, TimePeriod,
export #types.jl
Period, DatePeriod, TimePeriod,
Year, Month, Week, Day, Hour, Minute, Second, Millisecond,
Microsecond, Nanosecond,
TimeZone, UTC, TimeType, DateTime, Date, Time,
Expand Down
40 changes: 40 additions & 0 deletions stdlib/Dates/src/io.jl
Expand Up @@ -393,9 +393,49 @@ macro dateformat_str(str)
end

# Standard formats

#ISO8601 'DateTime' Format for 'date' and 'time' formatting. Default Format.
#Example
'''
jldoctest

julia> Dates.ISODateTimeFormat
dateformat"yyyy-mm-ddTHH:MM:SS.s"

julia> Dates.format(Dates.now(), Dates.ISODateFormat)
"2019-04-15T17:18:05.439"

'''
const ISODateTimeFormat = DateFormat("yyyy-mm-dd\\THH:MM:SS.s")

#ISO8601 'Date' Format for 'date' formatting.
#Example
'''
jldoctest

julia> Dates.format(Dates.today(), Dates.ISODateFormat)
"2019-04-15"
'''
const ISODateFormat = DateFormat("yyyy-mm-dd")

#Default ISO8601 Time Format for time formatting.
#Example
'''
jldoctest

julia> Dates.format(Dates.Time(Dates.now()), ISOTimeFormat)
"17:22:01.292"
'''
const ISOTimeFormat = DateFormat("HH:MM:SS.s")

#Traditional RFC1123 Format for date/time formatting.
#Example
'''
jldoctest

julia> Dates.format(Dates.now(), RFC1123Format)
"Mon, 15 Apr 2019 17:26:57"
'''
const RFC1123Format = DateFormat("e, dd u yyyy HH:MM:SS")

default_format(::Type{DateTime}) = ISODateTimeFormat
Expand Down
1 change: 1 addition & 0 deletions stdlib/Dates/src/types.jl
Expand Up @@ -83,6 +83,7 @@ abstract type Calendar <: AbstractTime end
# ISOCalendar provides interpretation rules for UTInstants to civil date and time parts
struct ISOCalendar <: Calendar end

#Time Zones in ISO 8601 are represented as an offset from UTC
abstract type TimeZone end
struct UTC <: TimeZone end

Expand Down

0 comments on commit 7081354

Please sign in to comment.