Learn R Programming

timeDate (version 4051.111)

midnightStandard: Midnight standard

Description

Corrects "timeDate" objects if they do not fulfill the ISO8601 midnight standard.

Usage

midnightStandard (charvec, format)
midnightStandard2(charvec, format)

Value

for midnightStandard, a character vector,

for midnightStandard2, a POSIXct object with time zone "GMT".

Arguments

charvec

a character string or vector of dates and times.

format

a string, the format specification of the input character vector.

Details

midnightStandard2() calls strptime. Since the latter returns NAs for elements that don't conform to the midnight standard, the inputs corresponding to NAs are further processed to fix this.

midnightStandard() converts to character vector the result obtained from midnightStandard2().

See Also

whichFormat

Examples

Run this code
ch <- "2007-12-31 24:00"
midnightStandard(ch)
(ms2 <- midnightStandard2(ch))
class(ms2)

Run the code above in your browser using DataLab