SqlFunctions.DatePart Method

Definition

Overloads

DatePart(String, Nullable<DateTime>)

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

DatePart(String, Nullable<DateTimeOffset>)

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

DatePart(String, Nullable<TimeSpan>)

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

DatePart(String, String)

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

DatePart(String, Nullable<DateTime>)

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

[System.Data.Entity.DbFunction("SqlServer", "DATEPART")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="date")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="datePartArg")]
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

The part of the date to return the value.

date
Nullable<DateTime>

The date.

Returns

The the specified datepart of the specified date.

Attributes

Applies to

DatePart(String, Nullable<DateTimeOffset>)

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

[System.Data.Entity.DbFunction("SqlServer", "DATEPART")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="date")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="datePartArg")]
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

The part of the date to return the value.

date
Nullable<DateTimeOffset>

The date.

Returns

The specified datepart of the specified date.

Attributes

Applies to

DatePart(String, Nullable<TimeSpan>)

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

[System.Data.Entity.DbFunction("SqlServer", "DATEPART")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="date")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="datePartArg")]
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

The part of the date to return the value.

date
Nullable<TimeSpan>

The date.

Returns

The specified datepart of the specified date.

Attributes

Applies to

DatePart(String, String)

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

[System.Data.Entity.DbFunction("SqlServer", "DATEPART")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="date")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="datePartArg")]
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

The part of the date to return the value.

date
String

The date.

Returns

The specified datepart of the specified date.

Attributes

Applies to