My purpose is to calculate Julian Day based on a new reference, meaning that Julian Day 1 now will correspond to June 1st and Julian Day 366 to January 1st.
Hello everyone,
I've been struggling to calculate Julian Day where the reference day is not January 1st anymore. Indeed, I want to extract from my data Julian Day where June 1st correspond to 1 and January 1st to 366.
I tried to add 152 to Julian Day calculated with January 1st as a reference however my data than exceed 366 and I don't think it's the exact solution.
I'm really confused and know it's about mathematical suite but I'm not comfortable with it.
If you could help me I would be very grateful :)
Under the assumption that you meant
May 31instead ofJan 1, then a perhaps-convoluted method could start with:I included
05-31and06-01to demonstrate the two extremes of the June-1-based-julian-year. The last step (as.numeric) is mostly a defensive habit of mine:difftimeand similar functions often auto-change the units based on the scale of the difference, and that might be problematic; usingunits="days"forces this. (There are other ways to deal with this, as well.)One can functionize this with:
With brief validation: