R/am-pm.r

Defines functions pm am

Documented in am pm

#' Does date time occur in the am or pm?
#'
#' @export
#' @param x a date-time object
#' @return TRUE or FALSE depending on whether x occurs in the am or pm
#' @keywords chron
#' @examples
#' x <- ymd("2012-03-26")
#' am(x)
#' pm(x)
am <- function(x) hour(x) < 12

#' @export
#' @rdname am
pm <- function(x) !am(x)
hadley/lubridate documentation built on Feb. 3, 2024, 9:37 a.m.