|Posted by dsmith||PermalinkReply|
Thank you, it works as planned, now as:
int mo = Now.month; // --> 7
== Repost the article of Jonathan M Davis (jmdavisProg@gmx.com) == Posted at 2011/07/18 12:14 to digitalmars.D.learn
On Monday 18 July 2011 16:01:06 dsmith wrote:
> Recall that std.date used the following to retrieve a month in integer form (0 .. 11):
> auto Now = std.date.getUTCtime();
> Using std.datetime, the following yields the abbreviated month name:
> auto Now = Clock.currTime();
> writefln("%s", Now.month); // --> jul
> Now, how can std.datetime be used to print the month in integer form?
Cast it to an integer (or use std.conv.to will probably work - it _should_ at least; if it doesn't, it needs to be fixed). std.datetime.Month is a named enum. So, presumably that's why you're seeing it as a the enum's name. I think that that's only happening because you're using it directly in writefln though. If you assigned it to a variable first, I think that it would just be a ubyte, since that's the type of the Month enum).
- Jonathan M Davis