SqlFunctions.DatePart 方法

定義

傳回表示指定日期的指定日期部分的整數。

多載

名稱 Description
DatePart(String, Nullable<DateTime>)

傳回表示指定日期的指定日期部分的整數。

DatePart(String, Nullable<DateTimeOffset>)

傳回表示指定日期的指定日期部分的整數。

DatePart(String, Nullable<TimeSpan>)

傳回表示指定日期的指定日期部分的整數。

DatePart(String, String)

傳回表示指定日期的指定日期部分的整數。

備註

你不能直接呼叫這個函式。 此函式只能出現在 LINQ 對 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

日期中返還價值的部分。

date
Nullable<DateTime>

日期。

傳回

指定日期部分。

屬性

備註

你不能直接呼叫這個函式。 此函式只能出現在 LINQ 對 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>

日期。

傳回

指定日期部分。

屬性

備註

你不能直接呼叫這個函式。 此函式只能出現在 LINQ 對 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

日期中返還價值的部分。

date
Nullable<TimeSpan>

日期。

傳回

指定日期部分。

屬性

備註

你不能直接呼叫這個函式。 此函式只能出現在 LINQ 對 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

日期。

傳回

指定日期部分。

屬性

備註

你不能直接呼叫這個函式。 此函式只能出現在 LINQ 對 Entities 查詢中。

這個函式會被轉換成資料庫中的對應函式。 關於對應的SQL Server函數,請參見 DATEPART (Transact-SQL)

適用於