SolutionCottage.com
Posted  15 Dec 2008 - 16:16:06

Category: ASP.net


Use date DateTimeFormatInfo to make custom date formats

Issue:
It happens (quite frequently) that you need to format the time and date for various reasons. You can use the DateTime.Now.ToString() function for this.

Solution:
Do something like this:

Console.WriteLine(DateTime.Now.ToString("D"));

to output the string:

"Monday, December 15, 2008"

You can find a list of all the available formats at:

http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo(VS.71).aspx








0 comments:








© SolutionCottage 2008-2011 7/21/2017 3:35:57 AM