Pages

Wednesday 19 March 2014

How to Format a DateTime Object Using ToString() Method



It is very important that how we display dates and time to the user. Fortunately .Net framework facilitates us to convert DateTime objects to its equivalent string using a specific format. To do this we can use DateTime objects' ToString() method. The format should be mention within the brackets of the method. 

There are lot of formats we can use to format DateTime objects, here I have mention some commonly useful formats. First we will see standard formats;


Then some custom formats;
Above examples are working on and above .Net Framework 1.0.

No comments:

Post a Comment