-
-
Notifications
You must be signed in to change notification settings - Fork 383
Date difference to natural text
kappy edited this page Apr 9, 2012
·
2 revisions
This extensions can compare two dates in natural language based on the current locale on current thread CultureInfo. There are 2 API points for them:
-
fromDate.ToNaturalText(toTime, bool round = true)
-
fromDate.ToExactNaturalText(toTime)
The first will return the most valuable time component with value > 0. The round flag will try to round the most significant time component based on the next least significant. Also, the round flag will round minutes and seconds to quarters after the first one.