Conversions between POSIXct to HTTP Date objects.

Arguments

from

numeric, POSIXct or HTTPDate object.

References

RFC7231 MDN

Examples

# convert POSIXct to HTTP date string
as(0, "HTTPDate") # Thu, 01 Jan 1970 00:00:00 GMT
#> [1] "Thu, 01 Jan 1970 00:00:00 GMT"
#> attr(,"class")
#> [1] "HTTPDate"
as(Sys.time(), "HTTPDate")
#> [1] "Thu, 09 Jun 2022 10:23:54 GMT"
#> attr(,"class")
#> [1] "HTTPDate"
# parse HTTP date string to POSIXct
dt = "Thu, 01 Jan 1970 00:00:00 GMT"
class(dt) = "HTTPDate"
as(dt, "POSIXct")
#> [1] "1970-01-01 GMT"