1: DateTime dt = DateTime.Now;
2: String strDate="";
3: strDate = dt.ToString("MM/dd/yyyy"); // 07/21/2007
4: strDate = dt.ToString("dddd, dd MMMM yyyy"); //Saturday, 21 July 2007
5: strDate = dt.ToString("dddd, dd MMMM yyyy HH:mm"); // Saturday, 21 July 2007 14:58
6: strDate = dt.ToString("dddd, dd MMMM yyyy hh:mm tt"); // Saturday, 21 July 2007 03:00 PM
7: strDate = dt.ToString("dddd, dd MMMM yyyy H:mm"); // Saturday, 21 July 2007 5:01
8: strDate = dt.ToString("dddd, dd MMMM yyyy h:mm tt"); // Saturday, 21 July 2007 3:03 PM
9: strDate = dt.ToString("dddd, dd MMMM yyyy HH:mm:ss"); // Saturday, 21 July 2007 15:04:10
10: strDate = dt.ToString("MM/dd/yyyy HH:mm"); // 07/21/2007 15:05
11: strDate = dt.ToString("MM/dd/yyyy hh:mm tt"); // 07/21/2007 03:06 PM
12: strDate = dt.ToString("MM/dd/yyyy H:mm"); // 07/21/2007 15:07
13: strDate = dt.ToString("MM/dd/yyyy h:mm tt"); // 07/21/2007 3:07 PM
14: strDate = dt.ToString("MM/dd/yyyy HH:mm:ss"); // 07/21/2007 15:09:29
15: strDate = dt.ToString("MMMM dd"); // July 21
16: strDate = dt.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK"); // 2007-07-21T15:11:19.1250000+05:30
17: strDate = dt.ToString("ddd, dd MMM yyyy HH':'mm':'ss 'GMT'"); // Sat, 21 Jul 2007 15:12:16 GMT
18: strDate = dt.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss"); // 2007-07-21T15:12:57
19: strDate = dt.ToString("HH:mm"); // 15:14
20: strDate = dt.ToString("hh:mm tt"); // 03:14 PM
21: strDate = dt.ToString("H:mm"); // 5:15
22: strDate = dt.ToString("h:mm tt"); // 3:16 PM
23: strDate = dt.ToString("HH:mm:ss"); // 15:16:29
24: strDate = dt.ToString("yyyy'-'MM'-'dd HH':'mm':'ss'Z'"); // 2007-07-21 15:17:20Z
25: strDate = dt.ToString("dddd, dd MMMM yyyy HH:mm:ss"); // Saturday, 21 July 2007 15:17:58
26: strDate = dt.ToString("yyyy MMMM"); // 2007 July
Categories:
C#
0 comments:
Post a Comment