s-news
[Top] [All Lists]

Re: Convert character to timeDate

To: Richard <hujian@gmail.com>
Subject: Re: Convert character to timeDate
From: "F. Lee De Cola" <ldecola@usgs.gov>
Date: Tue, 1 Jul 2008 19:59:31 -0400
Cc: s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu
In-reply-to: <abe7feea0807011034r241d87f1kb3f17ade32f76ff6@mail.gmail.com>
TRY THIS:
-----
date.char <- c('20040102', '20040105', '20040106', '20040107', '20040108',
   '20040109')
timeDate(
  date.char,
  in.format = "%04Y%02m%02d",
  format    = "%04Y/%02m/%02d"
)
[1] 2004/01/02 2004/01/05 2004/01/06 2004/01/07 2004/01/08 2004/01/09
-----
Lee De Cola, PhD, MCP
U.S. Geological Survey
521 National Center
Reston VA 20192 USA
Room 2D324
703-648-4178, fax 4603
W77°22'10" N38°56'48"
703-709-6972 home
LDECOLA@USGS.GOV
ldecola.net


                                                                       
             Richard                                                   
             <hujian@gmail.com                                         
             >                                                          To
             Sent by:                  s-news@lists.biostat.wustl.edu  
             s-news-owner@list                                          cc
             s.biostat.wustl.e                                         
             du                                                    Subject
                                       [S] Convert character to timeDate
                                                                       
             2008-07-01 01:34                                          
             PM                                                        
                                                                       
                                                                       
                                                                       




Hi All,

I want to convert character series to timeDate format in order to create a
timeSeries object. The series is workdays without weekend. I am using
S-Plus Professional 6.1 (with Finmetrics). Or in Excel, how to convert?
Specifically,

20040102
20040105
20040106
20040107
20040108
20040109
....

to

2004/01/02
2004/01/05
2004/01/06
2004/01/07
2004/01/08
2004/01/09

Any thoughts? Thanks!



<Prev in Thread] Current Thread [Next in Thread>