문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top