DateTimeFormating


Well, with a href="http://dotnetweblogs.com/JLerman/posts/5868.aspx">lead in like
that I could not help but post.  This sample comes from a f style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">riend
of mine working who is helping me with a little book project…

style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">

style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">using style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> System; prefix = o ns = "urn:schemas-microsoft-com:office:office"
/>


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">using style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
System.Globalization;


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> 


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">namespace style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
Samples


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">  public
class
DateTimeFormatInfoSample


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">  {


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">    style="COLOR: blue">public static style="COLOR: blue">void "urn:schemas-microsoft-com:office:smarttags" /> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Main style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">()


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">    {


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">      DateTime d =
DateTime.Now;


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">     
DateTimeFormatInfo i =


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">         
new
CultureInfo(“fr-FR”).DateTimeFormat;


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">      style="COLOR: blue">string[] f =


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">          
i.GetAllDateTimePatterns();


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">      style="COLOR: blue">foreach(string s
in f)


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">       
Console.WriteLine(“ToString(\”{0}\”) yields: {1}”,


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">                         
s, d.ToString(s, i));


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">      lang=NO-BOK
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: NO-BOK">i
= new
CultureInfo(“en-AU”).DateTimeFormat;


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: NO-BOK"> style="mso-spacerun: yes">      f =
i.GetAllDateTimePatterns();


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: NO-BOK"> style="mso-spacerun: yes">      style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">foreach style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">( style="COLOR: blue">string s in
f)


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">       
Console.WriteLine(“ToString(\”{0}\”) yields: {1}”,


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">                         
s, d.ToString(s, i));


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes"> 


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">    }


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> style="mso-spacerun: yes">  }


style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"> style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}


And of course, here is the output for your reference:


ToString(“dd/MM/yyyy”) yields: 21/04/2003
ToString(“dd/MM/yy”) yields:
21/04/03
ToString(“dd.MM.yy”) yields: 21.04.03
ToString(“dd-MM-yy”)
yields: 21-04-03
ToString(“yyyy-MM-dd”) yields: 2003-04-21
ToString(“dddd
d MMMM yyyy”) yields: lundi 21 avril 2003
ToString(“d MMM yy”) yields: 21
avr. 03
ToString(“d MMMM yyyy”) yields: 21 avril 2003
ToString(“dddd d
MMMM yyyy HH:mm”) yields: lundi 21 avril 2003 22:15
ToString(“dddd d MMMM
yyyy H:mm”) yields: lundi 21 avril 2003 22:15
ToString(“dddd d MMMM yyyy
HH.mm”) yields: lundi 21 avril 2003 22.15
ToString(“dddd d MMMM yyyy HH’ h
‘mm”) yields: lundi 21 avril 2003 22 h 15
ToString(“d MMM yy HH:mm”) yields:
21 avr. 03 22:15
ToString(“d MMM yy H:mm”) yields: 21 avr. 03
22:15
ToString(“d MMM yy HH.mm”) yields: 21 avr. 03 22.15
ToString(“d MMM
yy HH’ h ‘mm”) yields: 21 avr. 03 22 h 15
ToString(“d MMMM yyyy HH:mm”)
yields: 21 avril 2003 22:15
ToString(“d MMMM yyyy H:mm”) yields: 21 avril
2003 22:15
ToString(“d MMMM yyyy HH.mm”) yields: 21 avril 2003
22.15
ToString(“d MMMM yyyy HH’ h ‘mm”) yields: 21 avril 2003 22 h
15
ToString(“dddd d MMMM yyyy HH:mm:ss”) yields: lundi 21 avril 2003
22:15:16
ToString(“dddd d MMMM yyyy H:mm:ss”) yields: lundi 21 avril 2003
22:15:16
ToString(“dddd d MMMM yyyy HH.mm”) yields: lundi 21 avril 2003
22.15
ToString(“dddd d MMMM yyyy HH’ h ‘mm”) yields: lundi 21 avril 2003 22 h
15
ToString(“d MMM yy HH:mm:ss”) yields: 21 avr. 03 22:15:16
ToString(“d
MMM yy H:mm:ss”) yields: 21 avr. 03 22:15:16
ToString(“d MMM yy HH.mm”)
yields: 21 avr. 03 22.15
ToString(“d MMM yy HH’ h ‘mm”) yields: 21 avr. 03 22
h 15
ToString(“d MMMM yyyy HH:mm:ss”) yields: 21 avril 2003
22:15:16
ToString(“d MMMM yyyy H:mm:ss”) yields: 21 avril 2003
22:15:16
ToString(“d MMMM yyyy HH.mm”) yields: 21 avril 2003
22.15
ToString(“d MMMM yyyy HH’ h ‘mm”) yields: 21 avril 2003 22 h
15
ToString(“dd/MM/yyyy HH:mm”) yields: 21/04/2003
22:15
ToString(“dd/MM/yyyy H:mm”) yields: 21/04/2003
22:15
ToString(“dd/MM/yyyy HH.mm”) yields: 21/04/2003
22.15
ToString(“dd/MM/yyyy HH’ h ‘mm”) yields: 21/04/2003 22 h
15
ToString(“dd/MM/yy HH:mm”) yields: 21/04/03 22:15
ToString(“dd/MM/yy
H:mm”) yields: 21/04/03 22:15
ToString(“dd/MM/yy HH.mm”) yields: 21/04/03
22.15
ToString(“dd/MM/yy HH’ h ‘mm”) yields: 21/04/03 22 h
15
ToString(“dd.MM.yy HH:mm”) yields: 21.04.03 22:15
ToString(“dd.MM.yy
H:mm”) yields: 21.04.03 22:15
ToString(“dd.MM.yy HH.mm”) yields: 21.04.03
22.15
ToString(“dd.MM.yy HH’ h ‘mm”) yields: 21.04.03 22 h
15
ToString(“dd-MM-yy HH:mm”) yields: 21-04-03 22:15
ToString(“dd-MM-yy
H:mm”) yields: 21-04-03 22:15
ToString(“dd-MM-yy HH.mm”) yields: 21-04-03
22.15
ToString(“dd-MM-yy HH’ h ‘mm”) yields: 21-04-03 22 h
15
ToString(“yyyy-MM-dd HH:mm”) yields: 2003-04-21
22:15
ToString(“yyyy-MM-dd H:mm”) yields: 2003-04-21
22:15
ToString(“yyyy-MM-dd HH.mm”) yields: 2003-04-21
22.15
ToString(“yyyy-MM-dd HH’ h ‘mm”) yields: 2003-04-21 22 h
15
ToString(“dd/MM/yyyy HH:mm:ss”) yields: 21/04/2003
22:15:16
ToString(“dd/MM/yyyy H:mm:ss”) yields: 21/04/2003
22:15:16
ToString(“dd/MM/yyyy HH.mm”) yields: 21/04/2003
22.15
ToString(“dd/MM/yyyy HH’ h ‘mm”) yields: 21/04/2003 22 h
15
ToString(“dd/MM/yy HH:mm:ss”) yields: 21/04/03
22:15:16
ToString(“dd/MM/yy H:mm:ss”) yields: 21/04/03
22:15:16
ToString(“dd/MM/yy HH.mm”) yields: 21/04/03
22.15
ToString(“dd/MM/yy HH’ h ‘mm”) yields: 21/04/03 22 h
15
ToString(“dd.MM.yy HH:mm:ss”) yields: 21.04.03
22:15:16
ToString(“dd.MM.yy H:mm:ss”) yields: 21.04.03
22:15:16
ToString(“dd.MM.yy HH.mm”) yields: 21.04.03
22.15
ToString(“dd.MM.yy HH’ h ‘mm”) yields: 21.04.03 22 h
15
ToString(“dd-MM-yy HH:mm:ss”) yields: 21-04-03
22:15:16
ToString(“dd-MM-yy H:mm:ss”) yields: 21-04-03
22:15:16
ToString(“dd-MM-yy HH.mm”) yields: 21-04-03
22.15
ToString(“dd-MM-yy HH’ h ‘mm”) yields: 21-04-03 22 h
15
ToString(“yyyy-MM-dd HH:mm:ss”) yields: 2003-04-21
22:15:16
ToString(“yyyy-MM-dd H:mm:ss”) yields: 2003-04-21
22:15:16
ToString(“yyyy-MM-dd HH.mm”) yields: 2003-04-21
22.15
ToString(“yyyy-MM-dd HH’ h ‘mm”) yields: 2003-04-21 22 h
15
ToString(“d MMMM”) yields: 21 avril
ToString(“d MMMM”) yields: 21
avril
ToString(“ddd, dd MMM yyyy HH’:’mm’:’ss ‘GMT'”) yields: lun., 21 avr.
2003 22:15:16 GMT
ToString(“ddd, dd MMM yyyy HH’:’mm’:’ss ‘GMT'”) yields:
lun., 21 avr. 2003 22:15:16 GMT
ToString(“yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss”)
yields: 2003-04-21T22:15:16
ToString(“HH:mm”) yields:
22:15
ToString(“H:mm”) yields: 22:15
ToString(“HH.mm”) yields:
22.15
ToString(“HH’ h ‘mm”) yields: 22 h 15
ToString(“HH:mm:ss”) yields:
22:15:16
ToString(“H:mm:ss”) yields: 22:15:16
ToString(“HH.mm”) yields:
22.15
ToString(“HH’ h ‘mm”) yields: 22 h 15
ToString(“yyyy’-‘MM’-‘dd
HH’:’mm’:’ss’Z'”) yields: 2003-04-21 22:15:16Z
ToString(“dddd d MMMM yyyy
HH:mm:ss”) yields: lundi 21 avril 2003 22:15:16
ToString(“dddd d MMMM yyyy
H:mm:ss”) yields: lundi 21 avril 2003 22:15:16
ToString(“dddd d MMMM yyyy
HH.mm”) yields: lundi 21 avril 2003 22.15
ToString(“dddd d MMMM yyyy HH’ h
‘mm”) yields: lundi 21 avril 2003 22 h 15
ToString(“d MMM yy HH:mm:ss”)
yields: 21 avr. 03 22:15:16
ToString(“d MMM yy H:mm:ss”) yields: 21 avr. 03
22:15:16
ToString(“d MMM yy HH.mm”) yields: 21 avr. 03 22.15
ToString(“d
MMM yy HH’ h ‘mm”) yields: 21 avr. 03 22 h 15
ToString(“d MMMM yyyy
HH:mm:ss”) yields: 21 avril 2003 22:15:16
ToString(“d MMMM yyyy H:mm:ss”)
yields: 21 avril 2003 22:15:16
ToString(“d MMMM yyyy HH.mm”) yields: 21 avril
2003 22.15
ToString(“d MMMM yyyy HH’ h ‘mm”) yields: 21 avril 2003 22 h
15
ToString(“MMMM yyyy”) yields: avril 2003
ToString(“MMMM yyyy”) yields:
avril 2003
ToString(“d/MM/yyyy”) yields: 21/04/2003
ToString(“d/MM/yy”)
yields: 21/04/03
ToString(“d/M/yy”) yields: 21/4/03
ToString(“d/M/yyyy”)
yields: 21/4/2003
ToString(“dd/MM/yy”) yields:
21/04/03
ToString(“dd/MM/yyyy”) yields: 21/04/2003
ToString(“dd-MMM-yy”)
yields: 21-Apr-03
ToString(“dd-MMMM-yyyy”) yields:
21-April-2003
ToString(“yyyy-MM-dd”) yields:
2003-04-21
ToString(“yy/MM/dd”) yields: 03/04/21
ToString(“yyyy/MM/dd”)
yields: 2003/04/21
ToString(“dddd, d MMMM yyyy”) yields: Monday, 21 April
2003
ToString(“d MMMM yyyy”) yields: 21 April 2003
ToString(“dddd, d MMMM
yyyy h:mm tt”) yields: Monday, 21 April 2003 10:15 PM
ToString(“dddd, d MMMM
yyyy H:mm”) yields: Monday, 21 April 2003 22:15
ToString(“dddd, d MMMM yyyy
HH:mm”) yields: Monday, 21 April 2003 22:15
ToString(“d MMMM yyyy h:mm tt”)
yields: 21 April 2003 10:15 PM
ToString(“d MMMM yyyy H:mm”) yields: 21 April
2003 22:15
ToString(“d MMMM yyyy HH:mm”) yields: 21 April 2003
22:15
ToString(“dddd, d MMMM yyyy h:mm:ss tt”) yields: Monday, 21 April 2003
10:15:16 PM
ToString(“dddd, d MMMM yyyy H:mm:ss”) yields: Monday, 21 April
2003 22:15:16
ToString(“dddd, d MMMM yyyy HH:mm:ss”) yields: Monday, 21 April
2003 22:15:16
ToString(“d MMMM yyyy h:mm:ss tt”) yields: 21 April 2003
10:15:16 PM
ToString(“d MMMM yyyy H:mm:ss”) yields: 21 April 2003
22:15:16
ToString(“d MMMM yyyy HH:mm:ss”) yields: 21 April 2003
22:15:16
ToString(“d/MM/yyyy h:mm tt”) yields: 21/04/2003 10:15
PM
ToString(“d/MM/yyyy H:mm”) yields: 21/04/2003 22:15
ToString(“d/MM/yyyy
HH:mm”) yields: 21/04/2003 22:15
ToString(“d/MM/yy h:mm tt”) yields: 21/04/03
10:15 PM
ToString(“d/MM/yy H:mm”) yields: 21/04/03 22:15
ToString(“d/MM/yy
HH:mm”) yields: 21/04/03 22:15
ToString(“d/M/yy h:mm tt”) yields: 21/4/03
10:15 PM
ToString(“d/M/yy H:mm”) yields: 21/4/03 22:15
ToString(“d/M/yy
HH:mm”) yields: 21/4/03 22:15
ToString(“d/M/yyyy h:mm tt”) yields: 21/4/2003
10:15 PM
ToString(“d/M/yyyy H:mm”) yields: 21/4/2003
22:15
ToString(“d/M/yyyy HH:mm”) yields: 21/4/2003
22:15
ToString(“dd/MM/yy h:mm tt”) yields: 21/04/03 10:15
PM
ToString(“dd/MM/yy H:mm”) yields: 21/04/03 22:15
ToString(“dd/MM/yy
HH:mm”) yields: 21/04/03 22:15
ToString(“dd/MM/yyyy h:mm tt”) yields:
21/04/2003 10:15 PM
ToString(“dd/MM/yyyy H:mm”) yields: 21/04/2003
22:15
ToString(“dd/MM/yyyy HH:mm”) yields: 21/04/2003
22:15
ToString(“dd-MMM-yy h:mm tt”) yields: 21-Apr-03 10:15
PM
ToString(“dd-MMM-yy H:mm”) yields: 21-Apr-03 22:15
ToString(“dd-MMM-yy
HH:mm”) yields: 21-Apr-03 22:15
ToString(“dd-MMMM-yyyy h:mm tt”) yields:
21-April-2003 10:15 PM
ToString(“dd-MMMM-yyyy H:mm”) yields: 21-April-2003
22:15
ToString(“dd-MMMM-yyyy HH:mm”) yields: 21-April-2003
22:15
ToString(“yyyy-MM-dd h:mm tt”) yields: 2003-04-21 10:15
PM
ToString(“yyyy-MM-dd H:mm”) yields: 2003-04-21
22:15
ToString(“yyyy-MM-dd HH:mm”) yields: 2003-04-21
22:15
ToString(“yy/MM/dd h:mm tt”) yields: 03/04/21 10:15
PM
ToString(“yy/MM/dd H:mm”) yields: 03/04/21 22:15
ToString(“yy/MM/dd
HH:mm”) yields: 03/04/21 22:15
ToString(“yyyy/MM/dd h:mm tt”) yields:
2003/04/21 10:15 PM
ToString(“yyyy/MM/dd H:mm”) yields: 2003/04/21
22:15
ToString(“yyyy/MM/dd HH:mm”) yields: 2003/04/21
22:15
ToString(“d/MM/yyyy h:mm:ss tt”) yields: 21/04/2003 10:15:16
PM
ToString(“d/MM/yyyy H:mm:ss”) yields: 21/04/2003
22:15:16
ToString(“d/MM/yyyy HH:mm:ss”) yields: 21/04/2003
22:15:16
ToString(“d/MM/yy h:mm:ss tt”) yields: 21/04/03 10:15:16
PM
ToString(“d/MM/yy H:mm:ss”) yields: 21/04/03 22:15:16
ToString(“d/MM/yy
HH:mm:ss”) yields: 21/04/03 22:15:16
ToString(“d/M/yy h:mm:ss tt”) yields:
21/4/03 10:15:16 PM
ToString(“d/M/yy H:mm:ss”) yields: 21/4/03
22:15:16
ToString(“d/M/yy HH:mm:ss”) yields: 21/4/03
22:15:16
ToString(“d/M/yyyy h:mm:ss tt”) yields: 21/4/2003 10:15:16
PM
ToString(“d/M/yyyy H:mm:ss”) yields: 21/4/2003
22:15:16
ToString(“d/M/yyyy HH:mm:ss”) yields: 21/4/2003
22:15:16
ToString(“dd/MM/yy h:mm:ss tt”) yields: 21/04/03 10:15:16
PM
ToString(“dd/MM/yy H:mm:ss”) yields: 21/04/03
22:15:16
ToString(“dd/MM/yy HH:mm:ss”) yields: 21/04/03
22:15:16
ToString(“dd/MM/yyyy h:mm:ss tt”) yields: 21/04/2003 10:15:16
PM
ToString(“dd/MM/yyyy H:mm:ss”) yields: 21/04/2003
22:15:16
ToString(“dd/MM/yyyy HH:mm:ss”) yields: 21/04/2003
22:15:16
ToString(“dd-MMM-yy h:mm:ss tt”) yields: 21-Apr-03 10:15:16
PM
ToString(“dd-MMM-yy H:mm:ss”) yields: 21-Apr-03
22:15:16
ToString(“dd-MMM-yy HH:mm:ss”) yields: 21-Apr-03
22:15:16
ToString(“dd-MMMM-yyyy h:mm:ss tt”) yields: 21-April-2003 10:15:16
PM
ToString(“dd-MMMM-yyyy H:mm:ss”) yields: 21-April-2003
22:15:16
ToString(“dd-MMMM-yyyy HH:mm:ss”) yields: 21-April-2003
22:15:16
ToString(“yyyy-MM-dd h:mm:ss tt”) yields: 2003-04-21 10:15:16
PM
ToString(“yyyy-MM-dd H:mm:ss”) yields: 2003-04-21
22:15:16
ToString(“yyyy-MM-dd HH:mm:ss”) yields: 2003-04-21
22:15:16
ToString(“yy/MM/dd h:mm:ss tt”) yields: 03/04/21 10:15:16
PM
ToString(“yy/MM/dd H:mm:ss”) yields: 03/04/21
22:15:16
ToString(“yy/MM/dd HH:mm:ss”) yields: 03/04/21
22:15:16
ToString(“yyyy/MM/dd h:mm:ss tt”) yields: 2003/04/21 10:15:16
PM
ToString(“yyyy/MM/dd H:mm:ss”) yields: 2003/04/21
22:15:16
ToString(“yyyy/MM/dd HH:mm:ss”) yields: 2003/04/21
22:15:16
ToString(“dd MMMM”) yields: 21 April
ToString(“dd MMMM”) yields:
21 April
ToString(“ddd, dd MMM yyyy HH’:’mm’:’ss ‘GMT'”) yields: Mon, 21 Apr
2003 22:15:16 GMT
ToString(“ddd, dd MMM yyyy HH’:’mm’:’ss ‘GMT'”) yields:
Mon, 21 Apr 2003 22:15:16 GMT
ToString(“yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss”)
yields: 2003-04-21T22:15:16
ToString(“h:mm tt”) yields: 10:15
PM
ToString(“H:mm”) yields: 22:15
ToString(“HH:mm”) yields:
22:15
ToString(“h:mm:ss tt”) yields: 10:15:16 PM
ToString(“H:mm:ss”)
yields: 22:15:16
ToString(“HH:mm:ss”) yields:
22:15:16
ToString(“yyyy’-‘MM’-‘dd HH’:’mm’:’ss’Z'”) yields: 2003-04-21
22:15:16Z
ToString(“dddd, d MMMM yyyy h:mm:ss tt”) yields: Monday, 21 April
2003 10:15:16PM
ToString(“dddd, d MMMM yyyy H:mm:ss”) yields: Monday, 21
April 2003 22:15:16
ToString(“dddd, d MMMM yyyy HH:mm:ss”) yields: Monday, 21
April 2003 22:15:16
ToString(“d MMMM yyyy h:mm:ss tt”) yields: 21 April 2003
10:15:16 PM
ToString(“d MMMM yyyy H:mm:ss”) yields: 21 April 2003
22:15:16
ToString(“d MMMM yyyy HH:mm:ss”) yields: 21 April 2003
22:15:16
ToString(“MMMM yyyy”) yields: April 2003
ToString(“MMMM yyyy”)
yields: April 2003

Comments (1)

  1. Digging through some stuff on Brad’s Blog history I found this interesting post on DateTime formatting.

Skip to main content