日期:2014-05-19  浏览次数:20735 次

日期問題
Dim   jj   As   Date
jj   =   DateSerial(2007,   1,   1)

在C#中怎麼寫?C#中沒有DateSerial


------解决方案--------------------
DateTime jj = new DateTime(2007, 1, 1);
------解决方案--------------------
string str = dt.ToString( "yy.M.d ");
Console.WriteLine(str);
------解决方案--------------------
DateTime dt = new DateTime(2007,7,13);
------解决方案--------------------
DateTime.tryparse(new DateTime(...))
如果要实现 DateSerial函数 月份13自动调整到12的功能可能只能手写代码了 手动判断数字
------解决方案--------------------
datetime d = new DateTime(year, month, date);