Dates/times in HTTP headers needs a specific format to be valid, and is furthermore always given in GMT time. These two functions aids in converting back and forth between the required format.
to_http_date(time, format = NULL)
from_http_date(time)
A string or an object coercible to POSIXct
In case time
is not a POSIXct object a specification how the
string should be interpreted.
to_http_date()
returns a properly formatted string, while
from_http_date()
returns a POSIXct object
time <- to_http_date(Sys.time())
time
#> [1] "Fri, 19 Aug 2022 12:49:49 GMT"
from_http_date(time)
#> [1] "2022-08-19 12:49:49 GMT"