Reputation: 171
the member tm_mon
, in struct tm
is stored as an integer. I'm looking for another time stuct
that stores the actual name of the month. I can get the user-friendly format with
ctime();
but how can I selectively output just the month?
Upvotes: 1
Views: 41
Reputation: 3192
Have an array like,
string Months[] = {"January", "February", ... };
Then when you want to print use,
time_t t = time(0); // get time now
struct tm * now = localtime( & t );
cout << Months[now-> tm_mon];
Upvotes: 1