
Format date and datetime using journal conventions (ISO 8601)
Source:R/format_date.R
format_date_as_journal.RdFormats dates and datetimes with the ISO 8601 conventions that journals use.
See also
format_date_as_nor gives the Norwegian equivalents.
The "Date format comparison" section of vignette("csstyle")
demonstrates format_date_as_journal() and
format_datetime_as_journal(). That section does not demonstrate
format_datetime_as_journal_file().
Examples
# Format current date/time using journal conventions (ISO 8601)
format_date_as_journal()
#> [1] "2026-08-06"
format_datetime_as_journal()
#> [1] "2026-08-06 09:36:50"
# Format specific dates
format_date_as_journal(as.Date("2023-12-25"))
#> [1] "2023-12-25"
format_datetime_as_journal_file(as.POSIXct("2023-12-25 14:30:00"))
#> [1] "2023_12_25_143000"