All C# extension methods for type datetime
-
DateRange
A simple date range
-
IsWeekend
Lets you easily figure out ifdateTime holds a date value that is a weekend.
-
Age
Get the actual age of a person
-
Intersects
Returns true if two date ranges intersect.
-
IsBetween
Checks if the date is between the two provided dates
-
DateTimeFormat
This is extension method for format the data time into the string with pattern specific and current culture. For more information please read at my blog http://weblogs.asp.net/thangchung/archive/2010/11/01/datetime-formating-extension-method.aspx
-
AddWorkdays
A modification to the AddDay function that adds an integer number of weekdays to a date, starting the count at the first weekday after the current day. This is a typical method for calculating B2B service delivery and billing due dates.
-
GetLastDayOfMonth
Gets the last date of the month of the DateTime.
-
ToUnixTimestamp
Converts a System.DateTime object to Unix timestamp.
-
DateDiff
DateDiff in SQL style. The following DateParts are implemented: - "year" (abbr. "yy", "yyyy") - "quarter" (abbr. "qq", "q") - "month" (abbr. "mm", "m") - "day" (abbr. "dd", "d") - "week" (abbr. "wk", "ww") - "hour" (abbr. "hh") - "minute" (abbr. "mi", "n") - "second" (abbr. "ss", "s") - "millisecond" (abbr. "ms")
-
ToDateTime
Gets a nullable DateTime object from a string input. Good for grabbing datetimes from user inputs, like textboxes and querystrings.
-
IsInRange
Determines if a date is within a given date range
-
IsLeapYear
Returns whether or not a DateTime is during a leap year.
-
ToFriendlyDateString
The idea behind the ToFriendlyDateString() method is representing dates in a user friendly way. For example, when displaying a news article on a webpage, you might want articles that were published one day ago to have their publish dates represented as "yesterday at 12:30 PM". Or if the article was publish today, show the date as "Today, 3:33 PM".
-
ToShamsiDate
Convert DateTime to ShamsiDateString
-
Elapsed
Get the elapsed time since the input DateTime
-
EndOfTheMonth
Returns datetime corresponding to last day of the month
-
ToString
returns a formatted string on a nullable date
-
EndOfTheDay
Returns datetime corresponding to day end
-
NextSunday
Get's the date of the upcoming Sunday.
-
AddTime
Adds time to existing DateTime
-
AddWorkDays
This extension add "working day" to a date, where working day means from Monday to Friday.
-
ToRFC822DateString
Converts a regular DateTime to a RFC822 date string used for RSS feeds
-
TimeElapsed
Inspiration for this extension method was another DateTime extension that determines difference in current time and a DateTime object. That one returned a string and it is more useful for my applications to have a TimeSpan reference instead. That is what I did with this extension method.
-
ThisWeekMonday
Returns a DateTime representing the Monday of the current week. Depends on System.Globalization
-
IsLeapDay
Checks if the current day is a leap day
-
NullDateToString
Prints out a nullable datetime's value (if its not null) in the string format specified as a parameter. A final parameter is specified for what to print if the nullable datetime was, in fact, null.
-
ElapsedSeconds
Gest the elapsed seconds since the input DateTime
-
ToOracleSqlDate
Converts a Timestamp to a String which can be used in a Oracle SQL Query
-
BeginningOfTheMonth
Returns datetime corresponding to first day of the month
-
RemoveTicks
Legible way to remove ticks from a datetime. Use instead Add negative days
-
BeginningOfTheDay
Returns datetime corresponding to day beginning
-
ThisWeekFriday
Returns a DateTime representing the Friday of the current week. Depends on System.Globalization.
-
LengthOfTime
return the length of time between the start and current date
-
IsLastDayOfTheMonth
Returns whether the given date is the last day of the month.
-
GetDate
Return the current date and time
-
DateTimeFloor;DateTimeCeiling
Floor, Ceiling, Midpoint and Rounding calculations for various time intervals.
-
NextDayOfWeek
Will return the next occurring day of week
-
GetMonthDiff
Compute dateTime difference
-
DateTime Use in Library SystemManagement
this extension method is Used in Library System Management for return Recive book Date if you use this method this add to Date.Now 14 Days with change the Year and Month Day
-
GetTotalMonthDiff
Compute dateTime difference precisely
-
GetSaturday
This code will provide the Sunday DateTime from the week of DateTime object the extension method is called from.
-
GetSunday
This code will provide the Sunday DateTime from the week of DateTime object the extension method is called from.
-
NextAnniversary
Calculates the next anniversary of an event after the initial date on the Gregorian calendar. Use the original event date or the event month/event day as a parameters. The optional parameter, preserveMonth will determine how to handle an event date of 2/29. Set to true will use February 28 for a standard year anniversary and set to false will use March 1 for a standard year anniversary.
-
CurrentDateTimeInAmsterdam
Get the current date time in Amsterdam
-
CompareWithoutMinutes
Compares two datettime objects ignoring minutes and seconds
-
Next
Get next day of the week
-
FirstDayOfMonth
Return the first day of the mounth for a given date
-
DateTimeCheckValve
this ExtensionMethod check if startdate is null reutrn the min value of datetime and if the end date is null return the max value