Input a date/time string and output R date/time *format*. The format can then be used to convert to a different format. Determine Date and Time *format* from input (single record) using Perl regular expressions. Perl Code prepared by Ann Roseberry Lincoln Not all possible formats recognized but the most common are accepted. If AM/PM is left off them assume 24 hr time.

fun.DateTimeFormat(fun.DateTime, fun.dt.Type)

Arguments

fun.DateTime

Date, Time, or DateTime data

fun.dt.Type

type of input; date, time, or date

Value

Returns a text string representing the date/time format of the input fun.DateTime. Wrapper function for fun.dt.Type2().

Examples

#Not intended to be accessed indepedently.
#format of current date
fun.DateTimeFormat(Sys.Date(),"date")
#> [1] "%Y-%m-%d"
fun.DateTimeFormat(Sys.time(),"datetime")
#> [1] "%Y-%m-%d %H:%M:%S"