您的位置:首页 > 数据库

Sql Server与.Net(C#)中星期值对比

2017-04-11 16:45 302 查看
最近发现Sql Server与.Net(C#)中星期值居然不匹配,倒不知道依哪一个了。

1、Sql Server

declare @date datetime;
set @date = '2017-04-11';--实际为星期二
select DatePart(weekday,@date);


执行结果:



2、C#

#region 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll
#endregion

using System.Runtime.InteropServices;

namespace System
{
//
// 摘要:
//     Specifies the day of the week.
[ComVisible(true)]
public enum DayOfWeek
{
//
// 摘要:
//     Indicates Sunday.
Sunday = 0,
//
// 摘要:
//     Indicates Monday.
Monday = 1,
//
// 摘要:
//     Indicates Tuesday.
Tuesday = 2,
//
// 摘要:
//     Indicates Wednesday.
Wednesday = 3,
//
// 摘要:
//     Indicates Thursday.
Thursday = 4,
//
// 摘要:
//     Indicates Friday.
Friday = 5,
//
// 摘要:
//     Indicates Saturday.
Saturday = 6
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: