Convert Julian Day to Date in R (Example)
In this tutorial, I’ll show how to transform a Julian day to a calendar date object in the R programming language.
The post looks as follows:
So now the part you have been waiting for – the programming part:
Construction of Example Data
Initially, let’s create some example data in R:
my_julian <- 287 # Create example Julian day my_julian # Print example Julian day #  287
The previous output of the RStudio console shows the structure of our exemplifying data: It’s a simple integer value that corresponds to a Julian day.
Example: Convert Julian Day to Calendar Date Using as.Date() Function
The following R programming code illustrates how to get the calendar date that corresponds to a Julian day.
For this task, we can apply the as.Date function as shown below. Within the as.Date function, we have to specify the origin for our Julian day:
my_date <- as.Date(my_julian, # Convert Julian day to date origin = as.Date("2024-01-01")) my_date # Print date #  "2024-10-14"
The previous output shows the calendar date that corresponds to our Julian day, i.e. the 14th of October 2024.
Video, Further Resources & Summary
If you need further info on the R syntax of this tutorial, I recommend watching the following video which I have published on my YouTube channel. I explain the topics of this article in the video:
In addition, you might want to read the other tutorials which I have published on my website.
- Convert Date to Julian Day in R
- Convert Year, Month, Day, Hour, Minutes & Seconds to Date & Time
- Extract Day from Date in R
- Convert Date of Birth to Age
- Convert Date to Numeric Time Object in R
- Convert Date to Day of Week in R
- All R Programming Tutorials
In this post you have learned how to convert a Julian day to a calendar date in R programming. If you have further questions, don’t hesitate to let me know in the comments.