Conversions between POSIXct to HTTP Date objects.
numeric
, POSIXct
or HTTPDate
object.
# 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, 18 Apr 2024 01:55:02 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"