I have been seeing climate data sets that use decimal years. This is very convenient for some things. Is there a Mathematica function that converts DateObjects to decimal years?
Something like this?
1900. + AbsoluteTime[Today]/ QuantityMagnitude[Quantity[1, "Years"], "Seconds"]
Thanks! I’ll check it out.
Notice that
1900. + AbsoluteTime[{2024,12,31}]/QuantityMagnitude[Quantity[1,"Years"],"Seconds"] (* 2025.03 *)
This seems better:
DateValue[{2024,12,31},"Year"] + DateValue[{2024,12,31},"YearFraction"] (* 2024.95 *)
By "decimal years" do you mean something like today (April 5) is 0.26 years from the beginning of the year?
DateDifference[DateObject[{2024, 1}], DateObject[{2024, 4, 5}], "Year"] (* Quantity[0.25956284153005466, "Years"] *)
Thanks, Eric! I appreciate the help.