SqlFunctions.DatePart SqlFunctions.DatePart SqlFunctions.DatePart SqlFunctions.DatePart Method

Definition

Returns an integer that represents the specified datepart of the specified date.

Overloads

DatePart(String, Nullable<DateTime>) DatePart(String, Nullable<DateTime>) DatePart(String, Nullable<DateTime>) DatePart(String, Nullable<DateTime>)

Returns an integer that represents the specified datepart of the specified date.

DatePart(String, Nullable<DateTimeOffset>) DatePart(String, Nullable<DateTimeOffset>) DatePart(String, Nullable<DateTimeOffset>) DatePart(String, Nullable<DateTimeOffset>)

Returns an integer that represents the specified datepart of the specified date.

DatePart(String, Nullable<TimeSpan>) DatePart(String, Nullable<TimeSpan>) DatePart(String, Nullable<TimeSpan>) DatePart(String, Nullable<TimeSpan>)

Returns an integer that represents the specified datepart of the specified date.

DatePart(String, String) DatePart(String, String) DatePart(String, String) DatePart(String, String)

Returns an integer that represents the specified datepart of the specified date.

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see DATEPART (Transact-SQL).

DatePart(String, Nullable<DateTime>) DatePart(String, Nullable<DateTime>) DatePart(String, Nullable<DateTime>) DatePart(String, Nullable<DateTime>)

Returns an integer that represents the specified datepart of the specified date.

public:
 static Nullable<int> DatePart(System::String ^ datePartArg, Nullable<DateTime> date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")]
public static Nullable<int> DatePart (string datePartArg, Nullable<DateTime> date);
static member DatePart : string * Nullable<DateTime> -> Nullable<int>
Public Shared Function DatePart (datePartArg As String, date As Nullable(Of DateTime)) As Nullable(Of Integer)

Parameters

datePartArg
String String String String

The part of the date to return the value.

date
Nullable<DateTime>

The date.

Returns

The specified datepart of the specified date.

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see DATEPART (Transact-SQL).

DatePart(String, Nullable<DateTimeOffset>) DatePart(String, Nullable<DateTimeOffset>) DatePart(String, Nullable<DateTimeOffset>) DatePart(String, Nullable<DateTimeOffset>)

Returns an integer that represents the specified datepart of the specified date.

public:
 static Nullable<int> DatePart(System::String ^ datePartArg, Nullable<DateTimeOffset> date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")]
public static Nullable<int> DatePart (string datePartArg, Nullable<DateTimeOffset> date);
static member DatePart : string * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DatePart (datePartArg As String, date As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)

Parameters

datePartArg
String String String String

The part of the date to return the value.

date
Nullable<DateTimeOffset>

The date.

Returns

The specified datepart of the specified date.

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see DATEPART (Transact-SQL).

DatePart(String, Nullable<TimeSpan>) DatePart(String, Nullable<TimeSpan>) DatePart(String, Nullable<TimeSpan>) DatePart(String, Nullable<TimeSpan>)

Returns an integer that represents the specified datepart of the specified date.

public:
 static Nullable<int> DatePart(System::String ^ datePartArg, Nullable<TimeSpan> date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")]
public static Nullable<int> DatePart (string datePartArg, Nullable<TimeSpan> date);
static member DatePart : string * Nullable<TimeSpan> -> Nullable<int>
Public Shared Function DatePart (datePartArg As String, date As Nullable(Of TimeSpan)) As Nullable(Of Integer)

Parameters

datePartArg
String String String String

The part of the date to return the value.

date
Nullable<TimeSpan>

The date.

Returns

The specified datepart of the specified date.

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see DATEPART (Transact-SQL).

DatePart(String, String) DatePart(String, String) DatePart(String, String) DatePart(String, String)

Returns an integer that represents the specified datepart of the specified date.

public:
 static Nullable<int> DatePart(System::String ^ datePartArg, System::String ^ date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEPART")]
public static Nullable<int> DatePart (string datePartArg, string date);
static member DatePart : string * string -> Nullable<int>
Public Shared Function DatePart (datePartArg As String, date As String) As Nullable(Of Integer)

Parameters

datePartArg
String String String String

The part of the date to return the value.

date
String String String String

The date.

Returns

The specified datepart of the specified date.

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see DATEPART (Transact-SQL).

Applies to