using System;
using System.Globalization;
public class MainClass {
public static void Main(string[] args) {
DateTime dt = DateTime.Now;
String[] format = {
"d", "D",
"f", "F",
"g", "G",
"m",
"r",
"s",
"t", "T",
"u", "U",
"y",
"dddd, MMMM dd yyyy",
"ddd, MMM d /"'/"yy",
"dddd, MMMM dd",
"M/yy",
"dd-MM-yy",
};
String date;
for (int i = 0; i < format.Length; i++) {
//date = dt.ToString(format[i], DateTimeFormatInfo.InvariantInfo);
date = dt.ToString(format[i]);
Console.WriteLine(String.Concat(format[i], " :" , date));
}
/** Output.
d :2005-6-11
D :2005年6月11日
f :2005年6月11日 11:13
F :2005年6月11日 11:13:14
g :2005-6-11 11:13
G :2005-6-11 11:13:14
m :6月11日
r :Sat, 11 Jun 2005 11:13:14 GMT
s :2005-06-11T11:13:14
t :11:13
T :11:13:14
u :2005-06-11 11:13:14Z
U :2005年6月11日 3:13:14
y :2005年6月
dddd, MMMM dd yyyy :星期六, 六月 11 2005
ddd, MMM d "'"yy :星期六, 六月 11 '05
dddd, MMMM dd :星期六, 六月 11
M/yy :6-05
dd-MM-yy :11-06-05
*/
}
}