Getting a month from a fort date object

I have a boost :: date object. When I call the month () interface on an object, it returns to me the month that the object holds, but in terms of a string. Is there a way to get the number associated with the month? i.e

date mySampleDate = date_from_tm(tm_myDate) ;
cout<<mySampleDate.month() ; //Gives the output as May/Jun/Jul etc. I need 5/6/7 etc.

I need to get this without restoring the boost object to the tm structure. This will lead to too many conversions and a possible result for me.

+4
source share
1 answer

cout<<mySampleDate.month().as_number(); exactly what you want!

+4
source

All Articles