Module DateToStringExample
Public Sub Main()
Dim dateValue As Date = #6/15/2010 9:15:07PM#
Dim customFmts() As String = {"h:mm:ss.ff t", "d MMM yyyy", "HH:mm:ss.f", _
"dd MMM HH:mm:ss", "\Mon\t\h\: M", "HH:mm:ss.ffffzzz" }
' Output date and time using each custom format string.
For Each customFmt As String In customFmts
Console.WriteLine("'{0}': {1}", customFmt, _
dateValue.ToString(customFmt))
Next
End Sub
End Module