DbFunctions.TruncateTime Method (Nullable<DateTime>)

[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
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "dateValue")> _
<DbFunctionAttribute("Edm", "TruncateTime")> _
Public Shared Function TruncateTime ( _
    dateValue As Nullable(Of DateTime) _
) As Nullable(Of DateTime)
'Usage
Dim dateValue As Nullable(Of DateTime)
Dim returnValue As Nullable(Of DateTime)

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

Parameters

Return Value

Type: System.Nullable<DateTime>
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