[R] Minutes after midnight to time

David Winsemius dwinsemius at comcast.net
Sat Dec 14 17:43:07 CET 2013


On Dec 13, 2013, at 1:34 PM, Trevor Davies wrote:

> Is there a quick function that can convert minutes (seconds) after midnight
> to a time?
> 
> i.e 670.93 (minutes after midnight) --> 11:10:56.**
> 
> I know it can be done by hand but I thought there must be a function for
> this already.

format( as.POSIXct(Sys.Date()) + 670.93*60,
        format="%H:%M:%S", tz="UCT")

[1] "11:10:55"

> 
> Thank you.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list