@@ -367,8 +367,9 @@ When parsing a time with a `p` specifier, any hour (either `H` or `I`) is interp
367
367
as a 12-hour clock, so the `I` code is mainly useful for output.
368
368
369
369
Creating a DateFormat object is expensive. Whenever possible, create it once and use it many times
370
- or try the `dateformat""` string macro. Using this macro creates the DateFormat object once at
371
- macro expansion time and reuses it later. see [`@dateformat_str`](@ref).
370
+ or try the [`dateformat""`](@ref @dateformat_str) string macro. Using this macro creates the DateFormat
371
+ object once at macro expansion time and reuses it later. There are also several [pre-defined formatters](@ref
372
+ Common-Date-Formatters), listed later.
372
373
373
374
See [`DateTime`](@ref) and [`format`](@ref) for how to use a DateFormat object to parse and write Date strings
374
375
respectively.
@@ -443,14 +444,63 @@ macro dateformat_str(str)
443
444
end
444
445
445
446
# Standard formats
447
+
448
+ """
449
+ Dates.ISODateTimeFormat
450
+
451
+ Describes the ISO8601 formatting for a date and time. This is the default value for `Dates.format`
452
+ of a `DateTime`.
453
+
454
+ # Example
455
+ ```jldoctest
456
+ julia> Dates.format(DateTime(2018, 8, 8, 12, 0, 43, 1), ISODateTimeFormat)
457
+ "2018-08-08T12:00:43.001"
458
+ ```
459
+ """
446
460
const ISODateTimeFormat = DateFormat (" yyyy-mm-dd\\ THH:MM:SS.s" )
461
+ default_format (:: Type{DateTime} ) = ISODateTimeFormat
462
+
463
+ """
464
+ Dates.ISODateFormat
465
+
466
+ Describes the ISO8601 formatting for a date. This is the default value for `Dates.format` of a `Date`.
467
+
468
+ # Example
469
+ ```jldoctest
470
+ julia> Dates.format(Date(2018, 8, 8), ISODateFormat)
471
+ "2018-08-08"
472
+ ```
473
+ """
447
474
const ISODateFormat = DateFormat (" yyyy-mm-dd" )
475
+ default_format (:: Type{Date} ) = ISODateFormat
476
+
477
+ """
478
+ Dates.ISOTimeFormat
479
+
480
+ Describes the ISO8601 formatting for a time. This is the default value for `Dates.format` of a `Time`.
481
+
482
+ # Example
483
+ ```jldoctest
484
+ julia> Dates.format(Time(12, 0, 43, 1), ISOTimeFormat)
485
+ "12:00:43.001"
486
+ ```
487
+ """
448
488
const ISOTimeFormat = DateFormat (" HH:MM:SS.s" )
489
+ default_format (:: Type{Time} ) = ISOTimeFormat
490
+
491
+ """
492
+ Dates.RFC1123Format
493
+
494
+ Describes the RFC1123 formatting for a date and time.
495
+
496
+ # Example
497
+ ```jldoctest
498
+ julia> Dates.format(DateTime(2018, 8, 8, 12, 0, 43, 1), RFC1123Format)
499
+ "Wed, 08 Aug 2018 12:00:43"
500
+ ```
501
+ """
449
502
const RFC1123Format = DateFormat (" e, dd u yyyy HH:MM:SS" )
450
503
451
- default_format (:: Type{DateTime} ) = ISODateTimeFormat
452
- default_format (:: Type{Date} ) = ISODateFormat
453
- default_format (:: Type{Time} ) = ISOTimeFormat
454
504
455
505
# ## API
456
506
0 commit comments