C# Class csShared.Utils.DateTimeExtensions

DateTime Extensions
显示文件 Open project: TNOCS/csTouch

Public Methods

Method Description
Elapsed ( this datetime ) : System.TimeSpan

Elapseds the time.

FirstDateTimeOfWeek ( this datetime ) : System.DateTime

Firsts the date time of week.

FirstDateTimeOfWeek ( this datetime, DayOfWeek firstDayOfWeek ) : System.DateTime

Firsts the date time of week.

GetDateTimeForDayOfWeek ( this datetime, DayOfWeek day ) : System.DateTime
GetDateTimeForDayOfWeek ( this datetime, DayOfWeek day, DayOfWeek firstDayOfWeek ) : System.DateTime

Gets the date time for day of week.

GetFirstDayOfTheMonth ( this datetime ) : System.DateTime
GetFirstDayOfTheYear ( this datetime ) : System.DateTime
GetValueOrDefaultToString ( this datetime, string defaultvalue ) : string
GetValueOrDefaultToString ( this datetime, string format, string defaultvalue ) : string
WeekOfYear ( this datetime ) : int

Weeks the of year.

WeekOfYear ( this datetime, DayOfWeek firstDayOfWeek ) : int

Weeks the of year.

WeekOfYear ( this datetime, System weekrule ) : int

Weeks the of year.

WeekOfYear ( this datetime, System weekrule, DayOfWeek firstDayOfWeek ) : int

Weeks the of year.

Private Methods

Method Description
DaysFromFirstDayOfWeek ( DayOfWeek current, DayOfWeek firstDayOfWeek ) : int

Dayses from first day of week.

Method Details

Elapsed() public static method

Elapseds the time.
public static Elapsed ( this datetime ) : System.TimeSpan
datetime this The datetime.
return System.TimeSpan

FirstDateTimeOfWeek() public static method

Firsts the date time of week.
public static FirstDateTimeOfWeek ( this datetime ) : System.DateTime
datetime this The datetime.
return System.DateTime

FirstDateTimeOfWeek() public static method

Firsts the date time of week.
public static FirstDateTimeOfWeek ( this datetime, DayOfWeek firstDayOfWeek ) : System.DateTime
datetime this The datetime.
firstDayOfWeek DayOfWeek The first day of week.
return System.DateTime

GetDateTimeForDayOfWeek() public static method

public static GetDateTimeForDayOfWeek ( this datetime, DayOfWeek day ) : System.DateTime
datetime this
day DayOfWeek
return System.DateTime

GetDateTimeForDayOfWeek() public static method

Gets the date time for day of week.
public static GetDateTimeForDayOfWeek ( this datetime, DayOfWeek day, DayOfWeek firstDayOfWeek ) : System.DateTime
datetime this The datetime.
day DayOfWeek The day.
firstDayOfWeek DayOfWeek The first day of week.
return System.DateTime

GetFirstDayOfTheMonth() public static method

public static GetFirstDayOfTheMonth ( this datetime ) : System.DateTime
datetime this
return System.DateTime

GetFirstDayOfTheYear() public static method

public static GetFirstDayOfTheYear ( this datetime ) : System.DateTime
datetime this
return System.DateTime

GetValueOrDefaultToString() public static method

public static GetValueOrDefaultToString ( this datetime, string defaultvalue ) : string
datetime this
defaultvalue string
return string

GetValueOrDefaultToString() public static method

public static GetValueOrDefaultToString ( this datetime, string format, string defaultvalue ) : string
datetime this
format string
defaultvalue string
return string

WeekOfYear() public static method

Weeks the of year.
public static WeekOfYear ( this datetime ) : int
datetime this The datetime.
return int

WeekOfYear() public static method

Weeks the of year.
public static WeekOfYear ( this datetime, DayOfWeek firstDayOfWeek ) : int
datetime this The datetime.
firstDayOfWeek DayOfWeek The first day of week.
return int

WeekOfYear() public static method

Weeks the of year.
public static WeekOfYear ( this datetime, System weekrule ) : int
datetime this The datetime.
weekrule System The weekrule.
return int

WeekOfYear() public static method

Weeks the of year.
public static WeekOfYear ( this datetime, System weekrule, DayOfWeek firstDayOfWeek ) : int
datetime this The datetime.
weekrule System The weekrule.
firstDayOfWeek DayOfWeek The first day of week.
return int