#' Ramene une date/heure a 5am
#'
#' Ramene une date heure a 5am UTC avec un decalage d'heures optionel; par defaut en UTC. fonctionne au changement d'heure ete/hiver
#'
#' @param date date/heure a decaler - converti en POSIXct
#' @param shift_hours nombre d'heures a decaler - positif ou negatif
#' @param tz fuseau horaire du resultat - UTC par defaut
#' @importFrom period floor_date force_tz
#' @export
#' @examples
#' f_goto_5am('2019-04-20 06:00')
#' f_goto_5am('2019-03-31 01:00', 8)
#'
#' @return POSIXct
#'
## Add in the author of the `data_summary()` function
#' @author OG, \email{olivier.granacher@trimet.fr}
f_goto_5am <- function(date = floor_date(Sys.time(), 'year'), shift_hours = 0 , tz ='UTC' ) {
p1 <- lubridate::period(5, units = 'hours')
p2 <- lubridate::period( floor(shift_hours), units = 'hours')
lubridate::force_tz(as.POSIXct(lubridate::floor_date(as.POSIXct(date), 'day') + p1 + p2), tz)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.