摘要:
1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=currentTime.Month; 1.4 取当前日 int 日=curre... 阅读全文
posted @ 2008-07-04 11:43
小菜籽
阅读(171)
评论(0)
推荐(0)
摘要:
日期转化一
为了达到不同的显示效果有时,我们需要对时间进行转化,默认格式为:2007-01-03 14:33:34 ,要转化为其他格式,要用到DateTime.ToString的方法(String, IFormatProvider),如下所示:
using System;
using System.Globalization;
String format=\"D\";
DateTime date=DataTime,Now;
Response.Write(date.ToString(format, DateTimeFormatInfo.InvariantInfo));
结果输出
Thursday, June 16, 2005
阅读全文
posted @ 2008-07-04 11:38
小菜籽
阅读(156)
评论(0)
推荐(0)