共用方式為


SqlFunctions.DatePart 方法

定義

傳回一個整數來代表指定之日期的指定日期部分。

多載

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

要傳回值的日期部分。

date
Nullable<DateTime>

日期。

傳回

指定之日期的指定日期部分。

屬性

備註

您無法直接呼叫此函式。 此函式只能出現在 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>

日期。

傳回

指定之日期的指定日期部分。

屬性

備註

您無法直接呼叫此函式。 此函式只能出現在 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

要傳回值的日期部分。

date
Nullable<TimeSpan>

日期。

傳回

指定之日期的指定日期部分。

屬性

備註

您無法直接呼叫此函式。 此函式只能出現在 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

日期。

傳回

指定之日期的指定日期部分。

屬性

備註

您無法直接呼叫此函式。 此函式只能出現在 LINQ to Entities 查詢內。

此函式會轉譯為資料庫中的對應函式。 如需對應 SQL Server 函數的相關信息,請參閱 DATEPART (Transact-SQL)

適用於