I use a function from here to calculate the sunrise and sunset and it returns:
sunrise sunset
6.49055593325792 18.2873900837081
I am struggling (trying with strftime
, POSIXct
or as.Date
functions) to convert it to real time, but so far without success.
As always, any suggestion is greatly appreciated.
@Arun's strategy works, but it might be easier to just do:
x <- c(6.49055593325792, 18.2873900837081)
today<-as.POSIXct('2012-01-23 00:00:00 EST')
today + (3600*x)
# "2012-01-23 06:29:26 EST" "2012-01-23 18:17:14 EST"
That will get you the seconds as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With