Domanda

I have a boost::date object. When I call month() interface on the object it returns me the month the object is holding but in terms of a string. Is there a way I can 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 recoverting the boost object into tm structure. This would result in too many converstions and a possible performance hit for me.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top