Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DateTime.Now.Year
Message
 
To
30/03/2004 16:20:37
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00890968
Message ID:
00891173
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
>Thanks... now I am using DateTime.Now.Month to get the month, and if it is a single number I want it to have a 0 before it, like 03 instead of 3 for March.

You can also use the build in DateTimeFormatInfo class for this:

DateTime.Now.ToString("MM") // Returns numeric month with single digit with leading zero

DateTime.Now.ToString("yy") // The year without century, single digit with leading zero

Many nifty useful things in the class:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemglobalizationdatetimeformatinfoclasstopic.asp

Good luck,
- Erik Niese-Petersen

Crazy Dane in USA.
Previous
Reply
Map
View

Click here to load this message in the networking platform