Share via


DbFunctions.TruncateTime Method (Nullable<DateTimeOffset>)

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

When used as part of a LINQ to Entities query, this method invokes the canonical TruncateTime EDM function to return the given date with the time portion cleared.

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

Syntax

'Declaration
<DbFunctionAttribute("Edm", "TruncateTime")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "dateValue")> _
Public Shared Function TruncateTime ( _
    dateValue As Nullable(Of DateTimeOffset) _
) As Nullable(Of DateTimeOffset)
'Usage
Dim dateValue As Nullable(Of DateTimeOffset)
Dim returnValue As Nullable(Of DateTimeOffset)

returnValue = DbFunctions.TruncateTime(dateValue)
[DbFunctionAttribute("Edm", "TruncateTime")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "dateValue")]
public static Nullable<DateTimeOffset> TruncateTime(
    Nullable<DateTimeOffset> dateValue
)
[DbFunctionAttribute(L"Edm", L"TruncateTime")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"dateValue")]
public:
static Nullable<DateTimeOffset> TruncateTime(
    Nullable<DateTimeOffset> dateValue
)
[<DbFunctionAttribute("Edm", "TruncateTime")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "dateValue")>]
static member TruncateTime : 
        dateValue:Nullable<DateTimeOffset> -> Nullable<DateTimeOffset> 
public static function TruncateTime(
    dateValue : Nullable<DateTimeOffset>
) : Nullable<DateTimeOffset>

Parameters

Return Value

Type: System.Nullable<DateTimeOffset>
The input date with the time portion cleared.

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.

See Also

Reference

DbFunctions Class

TruncateTime Overload

System.Data.Entity Namespace