1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | Module Module1 Sub Main() ' Acquire current time and then try format strings. Dim now As DateTime = DateTime.Now Console.WriteLine(now.ToString("d")) Console.WriteLine(now.ToString("D")) Console.WriteLine(now.ToString("f")) Console.WriteLine(now.ToString("F")) Console.WriteLine(now.ToString("g")) Console.WriteLine(now.ToString("G")) Console.WriteLine(now.ToString("m")) Console.WriteLine(now.ToString("M")) Console.WriteLine(now.ToString("o")) Console.WriteLine(now.ToString("O")) Console.WriteLine(now.ToString("s")) Console.WriteLine(now.ToString("t")) Console.WriteLine(now.ToString("T")) Console.WriteLine(now.ToString("u")) Console.WriteLine(now.ToString("U")) Console.WriteLine(now.ToString("y")) Console.WriteLine(now.ToString("Y")) End Sub End Module |
輸出效果:
5/18/2010
Tuesday, May 18, 2010
Tuesday, May 18, 2010 4:47 PM
Tuesday, May 18, 2010 4:47:55 PM
5/18/2010 4:47 PM
5/18/2010 4:47:55 PM
May 18
May 18
2010-05-18T16:47:55.9620000-06:00
2010-05-18T16:47:55.9620000-06:00
2010-05-18T16:47:55
4:47 PM
4:47:55 PM
2010-05-18 16:47:55Z
Tuesday, May 18, 2010 10:47:55 PM
May, 2010
May, 2010
沒有留言:
張貼留言