C# Class DateTimeExtensions.GeneralDateTimeExtensions

Mostrar archivo Open project: kappy/DateTimeExtensions

Public Methods

Method Description
Ceiling ( this dt, System.TimeSpan interval ) : System.DateTime

Ceiling the given DateTime object by the given time interval. i.e. 10:01 ceilinged by 10 minutes would be 10:10

FirstDayOfTheMonth ( this date ) : System.DateTime

Retrives the first day of the month of the date.

FirstDayOfWeekOfTheMonth ( this date, DayOfWeek dayOfweek ) : System.DateTime
Floor ( this dt, System.TimeSpan interval ) : System.DateTime

Floor the given DateTime object by the given time interval. i.e. 10:09 floored by 10 minutes would be 10:00

LastDayOfTheMonth ( this date ) : System.DateTime

Retrives the last day of the month of the date.

LastDayOfWeek ( this date, DayOfWeek dayOfweek ) : System.DateTime

Retrives the last day of the week that occourred since date.

If date.DayOfWeek is already dayOfweek, it will return the last one (seven days before)

LastDayOfWeekOfTheMonth ( this date, DayOfWeek dayOfweek ) : System.DateTime
NextDayOfWeek ( this date, DayOfWeek dayOfweek ) : System.DateTime

Retrives the next day of the week that will occour after date.

If date.DayOfWeek is already dayOfweek, it will return the next one (seven days after)

Round ( this dt, System.TimeSpan interval ) : System.DateTime

Round the given DateTime object by the given time interval. i.e. 10:09 rounded by 10 minutes would be 10:10

SetTime ( this date, int hour ) : System.DateTime
SetTime ( this date, int hour, int minute ) : System.DateTime
SetTime ( this date, int hour, int minute, int second ) : System.DateTime
SetTime ( this date, int hour, int minute, int second, int millisecond ) : System.DateTime

Method Details

Ceiling() public static method

Ceiling the given DateTime object by the given time interval. i.e. 10:01 ceilinged by 10 minutes would be 10:10
public static Ceiling ( this dt, System.TimeSpan interval ) : System.DateTime
dt this The given DateTime object
interval System.TimeSpan The time interval to ceiling by
return System.DateTime

FirstDayOfTheMonth() public static method

Retrives the first day of the month of the date.
public static FirstDayOfTheMonth ( this date ) : System.DateTime
date this A date from the month we want to get the first day.
return System.DateTime

FirstDayOfWeekOfTheMonth() public static method

public static FirstDayOfWeekOfTheMonth ( this date, DayOfWeek dayOfweek ) : System.DateTime
date this
dayOfweek DayOfWeek
return System.DateTime

Floor() public static method

Floor the given DateTime object by the given time interval. i.e. 10:09 floored by 10 minutes would be 10:00
public static Floor ( this dt, System.TimeSpan interval ) : System.DateTime
dt this The given DateTime object
interval System.TimeSpan The time interval to floor by
return System.DateTime

LastDayOfTheMonth() public static method

Retrives the last day of the month of the date.
public static LastDayOfTheMonth ( this date ) : System.DateTime
date this A date from the month we want to get the last day.
return System.DateTime

LastDayOfWeek() public static method

Retrives the last day of the week that occourred since date.
If date.DayOfWeek is already dayOfweek, it will return the last one (seven days before)
public static LastDayOfWeek ( this date, DayOfWeek dayOfweek ) : System.DateTime
date this A date.
dayOfweek DayOfWeek The kind of DayOfWeek we want to get.
return System.DateTime

LastDayOfWeekOfTheMonth() public static method

public static LastDayOfWeekOfTheMonth ( this date, DayOfWeek dayOfweek ) : System.DateTime
date this
dayOfweek DayOfWeek
return System.DateTime

NextDayOfWeek() public static method

Retrives the next day of the week that will occour after date.
If date.DayOfWeek is already dayOfweek, it will return the next one (seven days after)
public static NextDayOfWeek ( this date, DayOfWeek dayOfweek ) : System.DateTime
date this A date.
dayOfweek DayOfWeek The kind of DayOfWeek we want to get.
return System.DateTime

Round() public static method

Round the given DateTime object by the given time interval. i.e. 10:09 rounded by 10 minutes would be 10:10
public static Round ( this dt, System.TimeSpan interval ) : System.DateTime
dt this The given DateTime object
interval System.TimeSpan The time interval to round by
return System.DateTime

SetTime() public static method

public static SetTime ( this date, int hour ) : System.DateTime
date this
hour int
return System.DateTime

SetTime() public static method

public static SetTime ( this date, int hour, int minute ) : System.DateTime
date this
hour int
minute int
return System.DateTime

SetTime() public static method

public static SetTime ( this date, int hour, int minute, int second ) : System.DateTime
date this
hour int
minute int
second int
return System.DateTime

SetTime() public static method

public static SetTime ( this date, int hour, int minute, int second, int millisecond ) : System.DateTime
date this
hour int
minute int
second int
millisecond int
return System.DateTime