小解时间格式C#

 //DateTime.Parse()的作用就是把指定的字符串转换成DateTime类型,当然字符串要符合一定的格式
//不能是Ticks(长整型的18位数字),如果是字符串就只能是下面样式的写法
Console.WriteLine(DateTime.Parse("2012/12/12"));
------------------------------ 

//构造一个DateTime是有很多方法的常用的就这几种

DateTime dt = new DateTime(621355968000000000);
//DateTime dt = new DateTime(2012,12,14);
int a = int.Parse("1");
Console.WriteLine(a);
Console.WriteLine(DateTime.MinValue+"   "+DateTime.MaxValue+"   "+dt.Kind+"   "+dt.Ticks);

Console.WriteLine(dt.Date);

Console.ReadKey();
------------------
DateTime dt = new DateTime(2012,3,23);

DateTime dt2 = dt.AddDays(1);

Console.WriteLine("今天是{0},明天是{1}",DateTime.Now,dt2.Date);
 Console.ReadKey();

转载于:https://www.cnblogs.com/zhangran/archive/2012/03/23/2414255.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值