date_fun: Date function to convert character/other as.POSIXct to date.

View source: R/date_fun.R

date_funR Documentation

Date function to convert character/other as.POSIXct to date.

Description

Date function to convert character/other as.POSIXct to date.

Usage

date_fun(x, tz = "EST", form = "%F")

Arguments

x

as.POSIXct or as.character

tz

timezone (default set to Eastern Standard Time)

form

format (default set to YYYY-mm-dd)

Value

Helper function to format date (and date-time) fields

Examples

datetime=as.character(c("2015-05-01 08:00:00","2015-10-15 12:00:00","2015-10-15 5:00:00"))
date.fun(datetime);# just date
date.fun(datetime, form="%F %X"); #include date and time

date.fun("2020-05-01")
date.fun(as.Date("2020-05-01"))
date.fun(as.POSIXct("2020-05-01 12:00:00",tz="EST"),form="%F %H:%M:%S")
date.fun(as.POSIXct("2020-05-01 12:00:00",tz="UTC"),form="%F %H:%M:%S")

SwampThingPaul/AnalystHelper documentation built on Nov. 3, 2024, 10:02 a.m.