C# DateTime.ToString patterns

I often need to use there DateTime.ToString patterns and can never remember where I found an easy way of getting a complete overview with a lot of examples.

You can find a great overview at Geekzilla
The Official one is here: MSDN

You use the code in C# like so

DateTime dt = DateTime.Now;
dt.ToString(“[INSERT_FORMAT_HERE]”);
dt.ToString(“MM/dd/yyyy”)                           // Will show: 08/22/2006
dt.ToString(“MM/dd/yyyy HH:mm:ss”)     // Will show: 08/22/2006 06:30:07

Advertisements

, ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: