timeDate              package:fCalendar              R Documentation

'_t_i_m_e_D_a_t_e' _O_b_j_e_c_t_s _f_r_o_m _S_c_r_a_t_c_h

_D_e_s_c_r_i_p_t_i_o_n:

     Create a  'timeDate' object from scratch using a character vector.

_U_s_a_g_e:

     timeDate(charvec = Sys.timeDate(), format = NULL,
         zone = myFinCenter, FinCenter = myFinCenter)

_A_r_g_u_m_e_n_t_s:

 charvec: a character string or vector of dates and times. 

  format: the format specification of the input character vector. 

    zone: the time zone or financial center where the data were
          recorded. 

FinCenter: a character with the the location of the financial center
          named as "continent/city". 

_V_a_l_u_e:

     returns an object of class 'timeDate'.

_E_x_a_m_p_l_e_s:

     ## timeDate -

        # Character Vector Strings:
        dts = c("1989-09-28", "2001-01-15", "2004-08-30", "1990-02-09")
        tms = c(  "23:12:55",   "10:34:02",   "08:30:00",   "11:18:23")

        dts ; tms

        t1 <- timeDate(dts, format = "%Y-%m-%d", FinCenter = "GMT" )
        t1
        
        stopifnot(identical(t1, timeDate(dts, FinC = "GMT"))) # auto-format
        
        timeDate(dts, format = "%Y-%m-%d", FinCenter = "Europe/Zurich")
        
        timeDate(paste(dts, tms), format = "%Y-%m-%d %H:%M:%S",
                 zone = "GMT", FinCenter = "GMT")
        
        timeDate(paste(dts, tms), zone = "Europe/Zurich", FinCenter = "Europe/Zurich")
        
        timeDate(paste(dts, tms), format = "%Y-%m-%d %H:%M:%S",
                 zone = "GMT", FinCenter = "Europe/Zurich")

        ## non standard format:
        timeDate(paste(20:31, "03.2005", sep="."), format = "%d.%m.%Y")

        ## Note, ISO and American Formats are Auto-Detected:
        timeDate("2004-12-31", FinCenter = "GMT")
        timeDate("12/11/2004", FinCenter = "GMT")
        timeDate("1/31/2004") # auto-detect American format

        ## from POSIX?t, and using NAs
        lsec <- as.POSIXlt(.leap.seconds) ; lsec[c(2,4:6)] <- NA
        timeDate(lsec)

        dtms <- paste(dts,tms)
        dtms[2:3] <- NA
        timeDate(dtms, FinCenter = "Europe/Zurich")# but in GMT

