C# 클래스 Nvelope.DateTimeExtensions

파일 보기 프로젝트 열기: TrinityWestern/Nvelope

공개 메소드들

메소드 설명
AddMonthsMatchDay ( this dt, int numMonths, int dayToMatch ) : System.DateTime

Adds the specified number of months to a DateTime. Also sets the day of the month to match what you pass in, or the max day of the month, whichever is lesser. This function is useful when iterating through months and you initially start on the 31st and then in subsequent months get moved to 28 but then later want to return to the 31st.

Age ( this date ) : System.TimeSpan
DaysInMonth ( this dt ) : int

Returns the number of days in the month of this DateTime instance

DaysInYear ( this dt ) : int
EndOfMonth ( this me ) : System.DateTime
FuzzyName ( this age ) : string
IsEndOfMonth ( this dt ) : bool

Determines if this instance of a DateTime object is the last day in the month

IsEnteredDateWithinDateRange ( this enteredDate, System.DateTime startDate, System.DateTime endDate ) : bool

This method check if given date is in within given date range. This method is inclusive, which means it includes start and enddate as well to check the date range.

IsEnteredTimeWithTimeRange ( System.TimeSpan enteredTime, System.TimeSpan startTime, System.TimeSpan endTime ) : bool

This method check if given time is in within given time range

IsToday ( this source ) : bool

Is this datetime from the current calendar day?

IsValidTime ( string enteredTime ) : bool

This Method validates a give time.

MonthsDifference ( this start, System.DateTime end ) : int
OnSameDayAs ( this original, System.DateTime date ) : bool

Checks if a given DateTime is on the same day as this one

SameMinuteAs ( this me, System.DateTime other ) : bool
SameMonthAs ( this me, System.DateTime other ) : bool
StartOfMonth ( this me ) : System.DateTime
ToFriendlyDate ( this source ) : string

Returns a "friendly" formatted date (or a blank string)

ToFriendlyDate ( this date, IFormatProvider provider = null ) : string

Returns a "friendly" formatted date

ToIsoDate ( this source ) : string

Returns the ISO formatted date

ToIsoDateTime ( this source ) : string

Returns the ISO formatted date, using a space instead of a T for the seperator

ToShortTimeString ( this source ) : string

Returns the .NET ToShortTimeString() value but works with null values returning a blank string

ToString ( this source, string format ) : string

Converts to string, but handles null gracefully (converts to "")

ToUtc ( this date ) : System.DateTime
TruncSeconds ( this me ) : System.DateTime
ValidDate ( string date ) : bool

Determine if Date String is an actual date format = MM/DD/YYYY

메소드 상세

AddMonthsMatchDay() 공개 정적인 메소드

Adds the specified number of months to a DateTime. Also sets the day of the month to match what you pass in, or the max day of the month, whichever is lesser. This function is useful when iterating through months and you initially start on the 31st and then in subsequent months get moved to 28 but then later want to return to the 31st.
public static AddMonthsMatchDay ( this dt, int numMonths, int dayToMatch ) : System.DateTime
dt this
numMonths int
dayToMatch int
리턴 System.DateTime

Age() 공개 정적인 메소드

public static Age ( this date ) : System.TimeSpan
date this
리턴 System.TimeSpan

DaysInMonth() 공개 정적인 메소드

Returns the number of days in the month of this DateTime instance
public static DaysInMonth ( this dt ) : int
dt this
리턴 int

DaysInYear() 공개 정적인 메소드

public static DaysInYear ( this dt ) : int
dt this
리턴 int

EndOfMonth() 공개 정적인 메소드

public static EndOfMonth ( this me ) : System.DateTime
me this
리턴 System.DateTime

FuzzyName() 공개 정적인 메소드

public static FuzzyName ( this age ) : string
age this
리턴 string

IsEndOfMonth() 공개 정적인 메소드

Determines if this instance of a DateTime object is the last day in the month
public static IsEndOfMonth ( this dt ) : bool
dt this
리턴 bool

IsEnteredDateWithinDateRange() 공개 정적인 메소드

This method check if given date is in within given date range. This method is inclusive, which means it includes start and enddate as well to check the date range.
public static IsEnteredDateWithinDateRange ( this enteredDate, System.DateTime startDate, System.DateTime endDate ) : bool
enteredDate this
startDate System.DateTime
endDate System.DateTime
리턴 bool

IsEnteredTimeWithTimeRange() 공개 정적인 메소드

This method check if given time is in within given time range
public static IsEnteredTimeWithTimeRange ( System.TimeSpan enteredTime, System.TimeSpan startTime, System.TimeSpan endTime ) : bool
enteredTime System.TimeSpan
startTime System.TimeSpan Start Time Range
endTime System.TimeSpan End Time Range
리턴 bool

IsToday() 공개 정적인 메소드

Is this datetime from the current calendar day?
public static IsToday ( this source ) : bool
source this
리턴 bool

IsValidTime() 공개 정적인 메소드

This Method validates a give time.
public static IsValidTime ( string enteredTime ) : bool
enteredTime string
리턴 bool

MonthsDifference() 공개 정적인 메소드

public static MonthsDifference ( this start, System.DateTime end ) : int
start this
end System.DateTime
리턴 int

OnSameDayAs() 공개 정적인 메소드

Checks if a given DateTime is on the same day as this one
public static OnSameDayAs ( this original, System.DateTime date ) : bool
original this The first DateTime you are working with
date System.DateTime The DateTime to compare it with
리턴 bool

SameMinuteAs() 공개 정적인 메소드

public static SameMinuteAs ( this me, System.DateTime other ) : bool
me this
other System.DateTime
리턴 bool

SameMonthAs() 공개 정적인 메소드

public static SameMonthAs ( this me, System.DateTime other ) : bool
me this
other System.DateTime
리턴 bool

StartOfMonth() 공개 정적인 메소드

public static StartOfMonth ( this me ) : System.DateTime
me this
리턴 System.DateTime

ToFriendlyDate() 공개 정적인 메소드

Returns a "friendly" formatted date (or a blank string)
public static ToFriendlyDate ( this source ) : string
source this
리턴 string

ToFriendlyDate() 공개 정적인 메소드

Returns a "friendly" formatted date
public static ToFriendlyDate ( this date, IFormatProvider provider = null ) : string
date this
provider IFormatProvider
리턴 string

ToIsoDate() 공개 정적인 메소드

Returns the ISO formatted date
public static ToIsoDate ( this source ) : string
source this
리턴 string

ToIsoDateTime() 공개 정적인 메소드

Returns the ISO formatted date, using a space instead of a T for the seperator
public static ToIsoDateTime ( this source ) : string
source this
리턴 string

ToShortTimeString() 공개 정적인 메소드

Returns the .NET ToShortTimeString() value but works with null values returning a blank string
public static ToShortTimeString ( this source ) : string
source this
리턴 string

ToString() 공개 정적인 메소드

Converts to string, but handles null gracefully (converts to "")
public static ToString ( this source, string format ) : string
source this A nullable DateTime
format string A .NET DateTime formatting string
리턴 string

ToUtc() 공개 정적인 메소드

public static ToUtc ( this date ) : System.DateTime
date this
리턴 System.DateTime

TruncSeconds() 공개 정적인 메소드

public static TruncSeconds ( this me ) : System.DateTime
me this
리턴 System.DateTime

ValidDate() 공개 정적인 메소드

Determine if Date String is an actual date format = MM/DD/YYYY
public static ValidDate ( string date ) : bool
date string
리턴 bool