[R] Date format

About this list Date view Thread view Subject view Author view

From: Yu-Ling Wu (yuling5@yahoo.com)
Date: Sat 31 Mar 2001 - 04:35:02 EST


Message-ID: <20010330183502.31418.qmail@web11502.mail.yahoo.com>

Hi,

I try to convert a string into date format.
Please see the following two examples. When the
time is midnight (i.e. 00:00:00), R can't convert
it correctly and get a value of "NA". How to make
it work and get the value of "2001-03-23 00:00:00"?
Thanks!!

=Example 1=====================================

> S <- 20010323120000
> sTime <- strptime(paste(S), format="%Y%m%d%H%M%S")
> sTime
[1] "2001-03-23 12:00:00"

=Example 2=====================================

> T <- 20010323000000
> tTime <- strptime(paste(T), format="%Y%m%d%H%M%S")
> tTime
[1] "NA"

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2b30 : Fri 22 Jun 2001 - 18:58:38 EST