Re: [R] Extract time only from POSIXlt object

2011-01-30 Thread Simon Goodman
Those are all really helpful responses. Got it sorted now. Many thanks indeed! -- View this message in context: http://r.789695.n4.nabble.com/Extract-time-only-from-POSIXlt-object-tp3246751p3247105.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Extract time only from POSIXlt object

2011-01-30 Thread Gabor Grothendieck
On Sat, Jan 29, 2011 at 7:45 PM, Simon Goodman wrote: > > How can I extract only the time component from an POSIXlt object? > > For example if I try the following it still returns both the date and > time... > >>as.POSIXlt(tr.date[1]) > [1] "2010-10-18 21:46:53" >>as.POSIXlt(tr.date[1],"%H:%M:%S")

Re: [R] Extract time only from POSIXlt object

2011-01-30 Thread Jeff Newmiller
Try tt <- as.POSIXct("2011-01-29 15:00") tt-trunc(tt,"days") Note that this result can be used to add or subtract from datetime values, but I don't know of a convenient way to represent it as HH:MM:SS format. "Simon Goodman" wrote: > >How can I extract only the time component from an POSIXlt

Re: [R] Extract time only from POSIXlt object

2011-01-29 Thread David Winsemius
On Jan 29, 2011, at 7:45 PM, Simon Goodman wrote: How can I extract only the time component from an POSIXlt object? For example if I try the following it still returns both the date and time... as.POSIXlt(tr.date[1]) [1] "2010-10-18 21:46:53" as.POSIXlt(tr.date[1],"%H:%M:%S") [1] "2010-1

[R] Extract time only from POSIXlt object

2011-01-29 Thread Simon Goodman
How can I extract only the time component from an POSIXlt object? For example if I try the following it still returns both the date and time... >as.POSIXlt(tr.date[1]) [1] "2010-10-18 21:46:53" >as.POSIXlt(tr.date[1],"%H:%M:%S") [1] "2010-10-18 21:46:53" round and trunc don't help... is there