I need to write a function that converts a Julian dates (Year, Day of Year, Hour of Day and Minutes) into a standard form (Year, Month, Day of Month, Hour of Day and Minutes) and express it as a string. I figure there's got to be someone who's already written a library or component which can do the conversion from Day Of Year to Month and Day of Month. I've looked at several well-known datetime libraries:
- ctime - Specifically using a tm struct and
mktime(tm *timeptr)
as this generally sets the values of the tm struct to the appropriate places except that "The original values of the members tm_wday and tm_yday of timeptr are ignored..." which doesn't help. - Boost::DateTime - Gregorian is constructed
date(greg_year, greg_month, greg_day)
which doesn't help. However, they do have adate_from_tm(tm datetm)
but "The fields: tm_wday , tm_yday , tm_hour, tm_min, tm_sec, and tm_isdst are ignored." Again, no help. - COleDateTime - This project contains COM so why not? The COleDateTime constructor
COleDateTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec )
doesn't help. And I don't see any other conversion functions to go with it.
As you can see, these all need Month and Day of Month which is exactly what I'm trying to avoid in the first place. I must be either missing something or haven't looked in the right places (not perfect, as much as I try.)
Anyone can help? I'd prefer to avoid writing my own as there's almost always bound to be some gotcha I miss.