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
要傳回值的日期部分。
傳回
指定之日期的指定日期部分。
- 屬性
備註
您無法直接呼叫此函式。 此函式只能出現在 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
要傳回值的日期部分。
傳回
指定之日期的指定日期部分。
- 屬性
備註
您無法直接呼叫此函式。 此函式只能出現在 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) 。