Description Usage Arguments Value ISO 8601 RFC 2822 RFC 3339 YYYYMMDD Author(s) References Examples
ISO 8601, RFC 2822 and RFC 3339 are a standards for date and time representation covering the formatting of date and time (with or without possible fractional seconds) and timezone information.
1 2 3 4 5 6 7 |
pt |
A |
A character object formatted according to ISO 8601, RFC 2822 or RFC 3339
ISO 8601 is described in some detail in https://en.wikipedia.org/wiki/ISO_8601 and covers multiple date and time formats.
Here, we interpret it more narrowly focussing on a single format each for datetimes and dates. We return datetime object formatted as ‘2016-09-01T10:11:12’ and date object as ‘2016-09-01’.
If the option anytimeOldISO8601format
is set to TRUE
, then the previous
format (with a space instead of ‘T’ to separate date and time) is used.
RFC 2822 is described in some detail in https://www.ietf.org/rfc/rfc2822.txt and https://en.wikipedia.org/wiki/Email#Internet_Message_Format. The Date and Time formating cover only a subset of the specification in that RFC.
Here, we use it to provide a single format each for datetimes and dates. We return datetime object formatted as ‘Thu, 01 Sep 2016 10:11:12.123456 -0500’ and date object as ‘Thu, 01 Sep 2016’.
RFC 3339 is described in some detail in https://tools.ietf.org/html/rfc3339 It refines both earlier standards.
Here, we use it to format datetimes and dates as single and compact strings. We return datetime object formatted as ‘2016-09-01T10:11:12.123456-0500’ and date object as ‘2016-09-01’.
This is a truly terrible format which needs to die, but refuses to do so. If you are unfortunate enough to be forced to interoperate with code expecting it, you can use this function. But it would be better to take a moment to rewrite such code.
Dirk Eddelbuettel
https://en.wikipedia.org/wiki/ISO_8601, https://www.ietf.org/rfc/rfc2822.txt, https://en.wikipedia.org/wiki/Email#Internet_Message_Format, https://tools.ietf.org/html/rfc3339
1 2 3 4 5 6 7 8 9 10 11 | iso8601(anytime("2016-09-01 10:11:12.123456"))
iso8601(anydate("2016-Sep-01"))
rfc2822(anytime("2016-09-01 10:11:12.123456"))
rfc2822(anydate("2016-Sep-01"))
rfc3339(anytime("2016-09-01 10:11:12.123456"))
rfc3339(anydate("2016-Sep-01"))
yyyymmdd(anytime("2016-09-01 10:11:12.123456"))
yyyymmdd(anydate("2016-Sep-01"))
|
sh: 1: cannot create /dev/null: Permission denied
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : cannot open file '/etc/timezone': Permission denied
Warning: Your system is mis-configured: '/etc/localtime' is not a symlink
sh: 1: cannot create /dev/null: Permission denied
Warning message:
In fun(libname, pkgname) : No TZ information found. Falling back to UTC.
[1] "2016-09-01 10:11:12"
[1] "2016-09-01"
[1] "Thu, 01 Sep 2016 10:11:12 +0000"
[1] "Thu, 01 Sep 2016"
[1] "2016-09-01T10:11:12+0000"
[1] "2016-09-01"
[1] "20160901"
[1] "20160901"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.