This is preliminary documentation and is subject to change.

DateTimeExtensionsTruncateTo Method

Truncates the precision of a DateTime object to the given precision

Definition

Namespace: MoreDateTime.Extensions
Assembly: MoreDateTime (in MoreDateTime.dll) Version: 1.3.0
C#
public static DateTime TruncateTo(
	this DateTime dt,
	DateTimeExtensionsDateTruncate TruncateTo,
	CultureInfo? cultureInfo = null
)

Parameters

dt  DateTime
The DateTime object
TruncateTo  DateTimeExtensionsDateTruncate
The precision to truncate to
cultureInfo  CultureInfo  (Optional)
The CultureInfo to use for week calculation, can be null for current culture

Return Value

DateTime
The Truncated dateTime object

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also