Created
June 14, 2013 21:47
-
-
Save janeshdev/5785563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Let us assign a sample date as first with hours, minutes and seconds. | |
## It is also recommended to use the time zone | |
> date <- as.POSIXct("2013-06-14 16:34:26",tz="GMT") | |
## Convert to Julian date using the following function | |
> jddd <- julian(date, origin = as.POSIXct("2013-01-01 00:00:00",tz="GMT")) | |
> jddd | |
Time difference of 164.6906 days | |
## Check the class of object jddd | |
> class(jddd) | |
[1] "difftime" | |
> converted <- as.POSIXct("2013-01-01 00:00:00",tz="GMT")+jddd | |
> converted | |
[1] "2013-06-14 16:34:26 GMT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment