Skip to content

POSIXct date missing "time component"

4 messages · chuck.01, arun, Jeff Newmiller

#
Um, OK. 
My dates have times, they are 00:00:00 (i.e. midnight)
I'll just add a fraction of a second my dates and go with it.

Thanks for the reply. 




arun kirshna wrote
--
View this message in context: http://r.789695.n4.nabble.com/POSIXct-date-missing-time-component-tp4647932p4647939.html
Sent from the R help mailing list archive at Nabble.com.
#
Hi,

?as.POSIXct()
format: character string giving a date-time format as used by
????????? ?strptime?.

?strptime()
format: A character string.? The default for the ?format? methods is
????????? ?"%Y-%m-%d %H:%M:%S"? if any component has a time component
????????? which is not midnight, and ?"%Y-%m-%d"? otherwise.? If
????????? ?options("digits.secs")? is set, up to the specified number
????????? of digits will be printed for seconds.

So, may be it is better to add a sec and later subtract it.

?dates.mine2<-dates.mine+1
dates.mine2[3]
#[1] "2009-05-22 00:00:01 GMT"
?dates.mine3<-dates.mine2-1
?dates.mine3[3]
#[1] "2009-05-22 GMT"
A.K.






----- Original Message -----
From: chuck.01 <CharlieTheBrown77 at gmail.com>
To: r-help at r-project.org
Cc: 
Sent: Tuesday, October 30, 2012 5:21 PM
Subject: Re: [R] POSIXct  date missing "time component"

Um, OK. 
My dates have times, they are 00:00:00 (i.e. midnight)
I'll just add a fraction of a second my dates and go with it.

Thanks for the reply. 




arun kirshna wrote
--
View this message in context: http://r.789695.n4.nabble.com/POSIXct-date-missing-time-component-tp4647932p4647939.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
#
I did  not read that close enough; thanks again. 




arun kirshna wrote

            

            
--
View this message in context: http://r.789695.n4.nabble.com/POSIXct-date-missing-time-component-tp4647932p4647963.html
Sent from the R help mailing list archive at Nabble.com.
#
Rather than altering your data, it is better to use the same date time format at all times, and specify it explicitly when converting to or from character.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
"chuck.01" <CharlieTheBrown77 at gmail.com> wrote: