title: C++: Converting Julian dates to Gregorian
body: <p>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:</p>
  
  <ul>
  <li><a href="http://en.cppreference.com/w/cpp/chrono/c/ctime" rel="nofollow noreferrer">ctime</a> - Specifically using a tm struct and <code>mktime(tm *timeptr)</code> 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.</li>
  <li><a href="http://www.boost.org/doc/libs/1_42_0/doc/html/date_time.html" rel="nofollow noreferrer">Boost::DateTime</a> - Gregorian is constructed <code>date(greg_year, greg_month, greg_day)</code> which doesn't help.  However, they do have a <code>date_from_tm(tm datetm)</code> but "The fields: tm_wday , tm_yday , tm_hour, tm_min, tm_sec, and tm_isdst  are ignored."  Again, no help.</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/1yy4h318%28v=VS.80%29.aspx" rel="nofollow noreferrer">COleDateTime</a> - This project contains COM so why not? The COleDateTime constructor <code>COleDateTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec )</code> doesn't help.  And I don't see any other conversion functions to go with it.</li>
  </ul>
  
  <p>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.)  </p>
  
  <p>Anyone can help?  I'd prefer to avoid writing my own as there's almost always bound to be some gotcha I miss.</p>