using System.Globalization; String format="D"; DateTime date=DataTime,Now; Response.Write(date.ToString(format, DateTimeFormatInfo.InvariantInfo));结果输出 Thursday, June 16, 2005 参数format格式详细用法:格式字符 关联属性/说明 d ShortDatePattern D LongDatePattern f 完整日期和时间(长日期和短时间) F FullDateTimePattern(长日期和长时间) g 常规(短日期和短时间) G 常规(短日期和长时间) m、M MonthDayPattern r、R FC1123Pattern s 使用当地时间的 SortableDateTimePattern(基于 ISO 8601) t ShortTimePattern T LongTimePattern u UniversalSortableDateTimePattern 用于显示通用时间的格式 U 使用通用时间的完整日期和时间(长日期和长时间) y、Y YearMonthPattern
将该字段的默认值设置为getdate()即可(如果是access数据库将默认值设置为now()即可)这样连程序都不用改,数据库会自动填写数据提交时间的
using System.Globalization;
String format="D"; DateTime date=DataTime,Now; Response.Write(date.ToString(format, DateTimeFormatInfo.InvariantInfo));结果输出 Thursday, June 16, 2005
参数format格式详细用法:格式字符 关联属性/说明 d ShortDatePattern D LongDatePattern f 完整日期和时间(长日期和短时间) F FullDateTimePattern(长日期和长时间) g 常规(短日期和短时间) G 常规(短日期和长时间) m、M MonthDayPattern r、R FC1123Pattern s 使用当地时间的 SortableDateTimePattern(基于 ISO 8601) t ShortTimePattern T LongTimePattern u UniversalSortableDateTimePattern 用于显示通用时间的格式 U 使用通用时间的完整日期和时间(长日期和长时间) y、Y YearMonthPattern
insert getdate
datetime.now
在C#代码里反映出数据入库时间吗?保存成功后,记录时间(也有误差),不行吗