dfp_date_to_list: Format a datetime for DFP
Description
Take a datetime representation in R and convert it to the list required by
DFP to indicate a datetime
Usage
dfp_date_to_list(this_date, daytime = c("beginning", "end"),
timeZoneId = Sys.timezone(), ensure_today_works = TRUE)
Arguments
this_date
Date; formatted as Date, POSIXct, or POSIXlt
daytime
character; either "beginning" or "end" so that the function
knows which hours to set if needed
timeZoneId
character; a string indicating the timezone that should be used.
The timezone ID must be in Time_Zone database
ensure_today_works
logical; an indicator that will automatically offset
the current time by 1 hour so that forecasts will actually work. If you try to
forecast from a timestamp of now, then by the time you submit it to the ForecastService
it will already be too late to be in the future.
Value
a list
formatted to the spec required for StartDateTime or EndDateTime
Examples
Run this code# NOT RUN {
dfp_date_to_list(Sys.Date()+1)
# }
Run the code above in your browser using DataLab