SqlFunctions.DatePart Method

 

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

Namespace:   System.Data.Entity.SqlServer
Assembly:  EntityFramework.SqlServer (in EntityFramework.SqlServer.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticDatePart(String, Nullable<DateTime>)

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

System_CAPS_pubmethodSystem_CAPS_staticDatePart(String, Nullable<DateTimeOffset>)

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

System_CAPS_pubmethodSystem_CAPS_staticDatePart(String, Nullable<TimeSpan>)

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

System_CAPS_pubmethodSystem_CAPS_staticDatePart(String, String)

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


SqlFunctions.DatePart Method (String, Nullable<DateTime>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "date")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[DbFunctionAttribute("SqlServer", "DATEPART")]
public static Nullable<int> DatePart(
	string datePartArg,
	Nullable<DateTime> date
)

Parameters

datePartArg
Type: System.String

The part of the date to return the value.

date
Type: System.Nullable<DateTime>

The date.

Return Value

Type: System.Nullable<Int32>

The the specified datepart of the specified date.


SqlFunctions.DatePart Method (String, Nullable<DateTimeOffset>)

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

[DbFunctionAttribute("SqlServer", "DATEPART")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "date")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
public static Nullable<int> DatePart(
	string datePartArg,
	Nullable<DateTimeOffset> date
)

Parameters

datePartArg
Type: System.String

The part of the date to return the value.

date
Type: System.Nullable<DateTimeOffset>

The date.

Return Value

Type: System.Nullable<Int32>

The specified datepart of the specified date.


SqlFunctions.DatePart Method (String, Nullable<TimeSpan>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "date")]
[DbFunctionAttribute("SqlServer", "DATEPART")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
public static Nullable<int> DatePart(
	string datePartArg,
	Nullable<TimeSpan> date
)

Parameters

datePartArg
Type: System.String

The part of the date to return the value.

date
Type: System.Nullable<TimeSpan>

The date.

Return Value

Type: System.Nullable<Int32>

The specified datepart of the specified date.


SqlFunctions.DatePart Method (String, String)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "date")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[DbFunctionAttribute("SqlServer", "DATEPART")]
public static Nullable<int> DatePart(
	string datePartArg,
	string date
)

Parameters

datePartArg
Type: System.String

The part of the date to return the value.

date
Type: System.String

The date.

Return Value

Type: System.Nullable<Int32>

The specified datepart of the specified date.