首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

日期問題,该如何解决

2012-02-09 
日期問題DimjjAsDatejjDateSerial(2007,1,1)在C#中怎麼寫?C#中沒有DateSerial [解决办法]DateTime jj n

日期問題
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);

热点排行