SqlFunctions.DatePart 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回表示指定日期的指定日期部分的整数。
重载
DatePart(String, Nullable<DateTime>) |
返回表示指定日期的指定日期部分的整数。 |
DatePart(String, Nullable<DateTimeOffset>) |
返回表示指定日期的指定日期部分的整数。 |
DatePart(String, Nullable<TimeSpan>) |
返回表示指定日期的指定日期部分的整数。 |
DatePart(String, String) |
返回表示指定日期的指定日期部分的整数。 |
注解
不能直接调用此函数。 此函数只能出现在 LINQ to Entities 查询中。
此函数将转换为数据库中的相应函数。 有关相应SQL Server函数的信息,请参阅 DATEPART (Transact-SQL) 。
DatePart(String, Nullable<DateTime>)
返回表示指定日期的指定日期部分的整数。
public:
static Nullable<int> DatePart(System::String ^ datePartArg, Nullable<DateTime> date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")]
public static int? DatePart (string datePartArg, DateTime? date);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")>]
static member DatePart : string * Nullable<DateTime> -> Nullable<int>
Public Shared Function DatePart (datePartArg As String, date As Nullable(Of DateTime)) As Nullable(Of Integer)
参数
- datePartArg
- String
要返回值的日期部分。
返回
指定日期的指定 datepart。
- 属性
注解
不能直接调用此函数。 此函数只能出现在 LINQ to Entities 查询中。
此函数将转换为数据库中的相应函数。 有关相应SQL Server函数的信息,请参阅 DATEPART (Transact-SQL) 。
适用于
DatePart(String, Nullable<DateTimeOffset>)
返回表示指定日期的指定日期部分的整数。
public:
static Nullable<int> DatePart(System::String ^ datePartArg, Nullable<DateTimeOffset> date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")]
public static int? DatePart (string datePartArg, DateTimeOffset? date);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")>]
static member DatePart : string * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DatePart (datePartArg As String, date As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)
参数
- datePartArg
- String
要返回值的日期部分。
- date
- Nullable<DateTimeOffset>
日期。
返回
指定日期的指定 datepart。
- 属性
注解
不能直接调用此函数。 此函数只能出现在 LINQ to Entities 查询中。
此函数将转换为数据库中的相应函数。 有关相应SQL Server函数的信息,请参阅 DATEPART (Transact-SQL) 。
适用于
DatePart(String, Nullable<TimeSpan>)
返回表示指定日期的指定日期部分的整数。
public:
static Nullable<int> DatePart(System::String ^ datePartArg, Nullable<TimeSpan> date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")]
public static int? DatePart (string datePartArg, TimeSpan? date);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")>]
static member DatePart : string * Nullable<TimeSpan> -> Nullable<int>
Public Shared Function DatePart (datePartArg As String, date As Nullable(Of TimeSpan)) As Nullable(Of Integer)
参数
- datePartArg
- String
要返回值的日期部分。
返回
指定日期的指定 datepart。
- 属性
注解
不能直接调用此函数。 此函数只能出现在 LINQ to Entities 查询中。
此函数将转换为数据库中的相应函数。 有关相应SQL Server函数的信息,请参阅 DATEPART (Transact-SQL) 。
适用于
DatePart(String, String)
返回表示指定日期的指定日期部分的整数。
public:
static Nullable<int> DatePart(System::String ^ datePartArg, System::String ^ date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")]
public static int? DatePart (string datePartArg, string date);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")>]
static member DatePart : string * string -> Nullable<int>
Public Shared Function DatePart (datePartArg As String, date As String) As Nullable(Of Integer)
参数
- datePartArg
- String
要返回值的日期部分。
- date
- String
日期。
返回
指定日期的指定 datepart。
- 属性
注解
不能直接调用此函数。 此函数只能出现在 LINQ to Entities 查询中。
此函数将转换为数据库中的相应函数。 有关相应SQL Server函数的信息,请参阅 DATEPART (Transact-SQL) 。