C# Class Tp.Utils.DateUtils

显示文件 Open project: TargetProcess/Target-Process-Plugins

Public Methods

Method Description
DaysPassed ( System.DateTime baseDate ) : int
DaysPassed ( System.DateTime baseDate, System.DateTime today ) : int
DaysToCompletion ( System.DateTime baseDate ) : int
GetDays ( System.DateTime start, System.DateTime end ) : System.DateTime[]
GetMonths ( System.DateTime start, System.DateTime end ) : System.DateTime[]
GetNumberOfWorkingDaysInclusive ( System.DateTime startDate, System.DateTime endDate ) : int
GetTimeLag ( this current, System.DateTime previousDate ) : string
GetWeeks ( System.DateTime start, System.DateTime end ) : System.DateTime[]
GetWorkingDaysCount ( DateRange dateRange ) : int
GetWorkingDaysCount ( System.DateTime startDate, System.DateTime endDate ) : int
GetWorkingDaysLeftFromCurrentDate ( System.DateTime startDate, System.DateTime endDate ) : int
IsWorkingDay ( this date ) : bool

Check if date is a working day

The day of the week is checked at the moment. The holidays calendar can be added later

Max ( System.DateTime dateTime1, System.DateTime dateTime2 ) : DateTime?
ParseFromUniversalTime ( this input ) : System.DateTime
SetWorkingDays ( string notWorkingDays ) : void

Private Methods

Method Description
DateUtils ( ) : System
FindMonday ( System.DateTime date ) : System.DateTime
FromSqlString ( [ str ) : System.DateTime
ToSqlString ( [ date ) : string
ToSqlString ( this date ) : string

Method Details

DaysPassed() public static method

public static DaysPassed ( System.DateTime baseDate ) : int
baseDate System.DateTime
return int

DaysPassed() public static method

public static DaysPassed ( System.DateTime baseDate, System.DateTime today ) : int
baseDate System.DateTime
today System.DateTime
return int

DaysToCompletion() public static method

public static DaysToCompletion ( System.DateTime baseDate ) : int
baseDate System.DateTime
return int

GetDays() public static method

public static GetDays ( System.DateTime start, System.DateTime end ) : System.DateTime[]
start System.DateTime
end System.DateTime
return System.DateTime[]

GetMonths() public static method

public static GetMonths ( System.DateTime start, System.DateTime end ) : System.DateTime[]
start System.DateTime
end System.DateTime
return System.DateTime[]

GetNumberOfWorkingDaysInclusive() public static method

public static GetNumberOfWorkingDaysInclusive ( System.DateTime startDate, System.DateTime endDate ) : int
startDate System.DateTime
endDate System.DateTime
return int

GetTimeLag() public static method

public static GetTimeLag ( this current, System.DateTime previousDate ) : string
current this
previousDate System.DateTime
return string

GetWeeks() public static method

public static GetWeeks ( System.DateTime start, System.DateTime end ) : System.DateTime[]
start System.DateTime
end System.DateTime
return System.DateTime[]

GetWorkingDaysCount() public static method

public static GetWorkingDaysCount ( DateRange dateRange ) : int
dateRange DateRange
return int

GetWorkingDaysCount() public static method

public static GetWorkingDaysCount ( System.DateTime startDate, System.DateTime endDate ) : int
startDate System.DateTime
endDate System.DateTime
return int

GetWorkingDaysLeftFromCurrentDate() public static method

public static GetWorkingDaysLeftFromCurrentDate ( System.DateTime startDate, System.DateTime endDate ) : int
startDate System.DateTime
endDate System.DateTime
return int

IsWorkingDay() public static method

Check if date is a working day
The day of the week is checked at the moment. The holidays calendar can be added later
public static IsWorkingDay ( this date ) : bool
date this The date to be checked
return bool

Max() public static method

public static Max ( System.DateTime dateTime1, System.DateTime dateTime2 ) : DateTime?
dateTime1 System.DateTime
dateTime2 System.DateTime
return DateTime?

ParseFromUniversalTime() public static method

public static ParseFromUniversalTime ( this input ) : System.DateTime
input this
return System.DateTime

SetWorkingDays() public static method

public static SetWorkingDays ( string notWorkingDays ) : void
notWorkingDays string
return void