R/date_to_unix.R

Defines functions date_to_unix

Documented in date_to_unix

#' @title Date to unixtime
#' @description Convert date object to unixtime object.
#' 
#' @param date Insert date object as format YYYY-MM-DD.  Time (hms) will default to 
#' the current time derived from the current_time() function.
#' 
#' @importFrom lubridate ymd_hms
#' 
#' @return
#'
#' @examples
#' date_to_unix('2019-01-15')
date_to_unix <- function(date){
  time <- current_time()
  lubridate::ymd_hms(paste0(date, ' ', time), tz = finnhub_timezone) %>% 
    as.numeric
}
threadingdata/finnhubr documentation built on Aug. 10, 2020, 12:48 a.m.