C# 클래스 Yea.DataTypes.ExtensionMethods.DateTimeExtensions

DateTime extension methods
파일 보기 프로젝트 열기: OxPatient/Rule-Engine

공개 메소드들

메소드 설명
AddWeeks ( this date, int value ) : System.DateTime

�����������

CalculateAge ( this dateOfBirth ) : int

��������

CalculateAge ( this dateOfBirth, System.DateTime referenceDate ) : int

��������

ConvertToTimeZone ( this date, TimeZoneInfo timeZone ) : System.DateTime

Converts a DateTime to a specific time zone

DateDiff ( this sourceDate, System.DateTime compareDate, DateInterval interval ) : long

ʱ�����

DayOfWeek ( this date, DayOfWeek weekday, CultureInfo cultureInfo = null ) : System.DateTime

ȡ�ñ��ܵ����ڼ�

DaysBetween ( this fromDate, System.DateTime toDate ) : int

������������֮������������

DaysCountOfMonth ( this date ) : int

ȡ�õ�������

DaysInMonth ( this date ) : int

Returns the number of days in the month

DaysLeftInMonth ( this date ) : int

Gets the number of days left in the month based on the date passed in

DaysLeftInWeek ( this date ) : int

Gets the number of days left in a week

DaysLeftInYear ( this date ) : int

Gets the number of days left in a year based on the date passed in

DaysOfYear ( this date ) : int

���ص�ǰ����������ݵ�������

EndOfDay ( this input ) : System.DateTime

Returns the end of the day

FirstDayOfMonth ( this date ) : System.DateTime

Returns the first day of a month based on the date sent in

FirstDayOfQuarter ( this date, System.DateTime quarter1Start = default(DateTime) ) : System.DateTime

Returns the first day of a quarter based on the date sent in

FirstDayOfWeek ( this date, CultureInfo cultureInfo = null ) : System.DateTime

ȡ�ñ��ܵĵ�һ��

FirstDayOfYear ( this date ) : System.DateTime

Returns the first day of a year based on the date sent in

FirstWeekdayOfMonth ( this date, DayOfWeek dayOfWeek ) : System.DateTime

ȡ�õ��µĵ�һ�����ڼ�

FromUnixTime ( this date ) : System.DateTime

Returns the Unix based date as a DateTime object

GetDate ( this dateTime ) : Date
GetQuarter ( this date ) : int

ȡ�õ�ǰʱ�����ڵڣ�����

GetTime ( this dateTime ) : Time
IsDateEqual ( this date, System.DateTime dateToCompare ) : bool

�ж������Ƿ���ͬ������ʱ�䲿��

IsFirstDayOfMonth ( this date ) : bool

�ж��Ƿ�Ϊ���µ�һ��

IsInFuture ( this date ) : bool

Determines if the date is some time in the future

IsInPast ( this date ) : bool

Determines if the date is some time in the past

IsLastDayOfMonth ( this date ) : bool

�ж��Ƿ�Ϊ�������һ��

IsLeapYear ( this date ) : bool
IsTimeEqual ( this time, System.DateTime timeToCompare ) : bool

�ж�ʱ���Ƿ���ͬ���������ڲ���

IsToday ( this date ) : bool

Is this today?

IsWeekDay ( this date ) : bool

Determines if this is a week day

IsWeekEnd ( this date ) : bool

Determines if this is a week end

IsWeekend ( this date ) : bool

�ж��Ƿ�Ϊ��ĩ(����������)

LastDayOfMonth ( this date ) : System.DateTime

Returns the last day of the month based on the date sent in

LastDayOfQuarter ( this date, System.DateTime quarter1Start = default(DateTime) ) : System.DateTime

Returns the last day of a quarter based on the date sent in

LastDayOfWeek ( this date, CultureInfo cultureInfo = null ) : System.DateTime

ȡ�ñ��ܵ����һ��

LastDayOfYear ( this date ) : System.DateTime

Returns the last day of the year based on the date sent in

LastWeekdayOfMonth ( this date, DayOfWeek dayOfWeek ) : System.DateTime

ȡ�õ��µ����һ�����ڼ�

NextDayOfWeek ( this currentDate, DayOfWeek weekday, bool includeCurrentDate = true ) : System.DateTime

ȡ����һ�����ڼ�

PreviousWeekday ( this date, DayOfWeek weekday ) : System.DateTime

ȡ����һ�����ڼ�

RelativeTime ( this input, System.DateTime epoch ) : string

Converts the DateTime object to string describing, relatively how long ago or how far in the future the input is based off of another DateTime object specified. ex: Input=March 21, 2013 Epoch=March 22, 2013 returns "1 day ago" Input=March 22, 2013 Epoch=March 21, 2013 returns "1 day from now"

SetTime ( this date, System.TimeSpan time ) : System.DateTime

Sets the time portion of a specific date

SetTime ( this date, int hour, int minutes, int seconds ) : System.DateTime

Sets the time portion of a specific date

TimeSpanSince1970 ( this datetime ) : System.TimeSpan

ȡ����1970-01-01����ʱ����

ToDateTimeOffset ( this localDateTime, TimeZoneInfo localTimeZone = null ) : DateTimeOffset

תDateTimeOffset

ToUnix ( this date ) : int

Returns the date in Unix format

UTCOffset ( this date ) : double

Gets the UTC offset

WeeksOfYear ( this dateTime, CultureInfo cultureInfo = null ) : int

���ص�ǰ��ݵ���������

비공개 메소드들

메소드 설명
LocalTimeZone ( this date ) : TimeZoneInfo
Round ( double dVal ) : long

메소드 상세

AddWeeks() 공개 정적인 메소드

�����������
public static AddWeeks ( this date, int value ) : System.DateTime
date this ����
value int ���ӵ�������
리턴 System.DateTime

CalculateAge() 공개 정적인 메소드

��������
public static CalculateAge ( this dateOfBirth ) : int
dateOfBirth this ����
리턴 int

CalculateAge() 공개 정적인 메소드

��������
public static CalculateAge ( this dateOfBirth, System.DateTime referenceDate ) : int
dateOfBirth this ����
referenceDate System.DateTime �����
리턴 int

ConvertToTimeZone() 공개 정적인 메소드

Converts a DateTime to a specific time zone
public static ConvertToTimeZone ( this date, TimeZoneInfo timeZone ) : System.DateTime
date this DateTime to convert
timeZone System.TimeZoneInfo Time zone to convert to
리턴 System.DateTime

DateDiff() 공개 정적인 메소드

ʱ�����
public static DateDiff ( this sourceDate, System.DateTime compareDate, DateInterval interval ) : long
sourceDate this
compareDate System.DateTime
interval DateInterval ʱ����Ƚ�ö��
리턴 long

DayOfWeek() 공개 정적인 메소드

ȡ�ñ��ܵ����ڼ�
public static DayOfWeek ( this date, DayOfWeek weekday, CultureInfo cultureInfo = null ) : System.DateTime
date this ����
weekday DayOfWeek ���ڼ�
cultureInfo System.Globalization.CultureInfo �Ļ�
리턴 System.DateTime

DaysBetween() 공개 정적인 메소드

������������֮������������
public static DaysBetween ( this fromDate, System.DateTime toDate ) : int
fromDate this ����
toDate System.DateTime ����
리턴 int

DaysCountOfMonth() 공개 정적인 메소드

ȡ�õ�������
public static DaysCountOfMonth ( this date ) : int
date this
리턴 int

DaysInMonth() 공개 정적인 메소드

Returns the number of days in the month
public static DaysInMonth ( this date ) : int
date this Date to get the month from
리턴 int

DaysLeftInMonth() 공개 정적인 메소드

Gets the number of days left in the month based on the date passed in
public static DaysLeftInMonth ( this date ) : int
date this The date to check against
리턴 int

DaysLeftInWeek() 공개 정적인 메소드

Gets the number of days left in a week
public static DaysLeftInWeek ( this date ) : int
date this The date to check against
리턴 int

DaysLeftInYear() 공개 정적인 메소드

Gets the number of days left in a year based on the date passed in
public static DaysLeftInYear ( this date ) : int
date this The date to check against
리턴 int

DaysOfYear() 공개 정적인 메소드

���ص�ǰ����������ݵ�������
public static DaysOfYear ( this date ) : int
date this ����
리턴 int

EndOfDay() 공개 정적인 메소드

Returns the end of the day
public static EndOfDay ( this input ) : System.DateTime
input this Input date
리턴 System.DateTime

FirstDayOfMonth() 공개 정적인 메소드

Returns the first day of a month based on the date sent in
public static FirstDayOfMonth ( this date ) : System.DateTime
date this Date to get the first day of the month from
리턴 System.DateTime

FirstDayOfQuarter() 공개 정적인 메소드

Returns the first day of a quarter based on the date sent in
public static FirstDayOfQuarter ( this date, System.DateTime quarter1Start = default(DateTime) ) : System.DateTime
date this Date to get the first day of the quarter from
quarter1Start System.DateTime Beginning of the first quarter (defaults to the beginning of the year)
리턴 System.DateTime

FirstDayOfWeek() 공개 정적인 메소드

ȡ�ñ��ܵĵ�һ��
public static FirstDayOfWeek ( this date, CultureInfo cultureInfo = null ) : System.DateTime
date this ����
cultureInfo System.Globalization.CultureInfo �Ļ�
리턴 System.DateTime

FirstDayOfYear() 공개 정적인 메소드

Returns the first day of a year based on the date sent in
public static FirstDayOfYear ( this date ) : System.DateTime
date this Date to get the first day of the year from
리턴 System.DateTime

FirstWeekdayOfMonth() 공개 정적인 메소드

ȡ�õ��µĵ�һ�����ڼ�
public static FirstWeekdayOfMonth ( this date, DayOfWeek dayOfWeek ) : System.DateTime
date this ����
dayOfWeek DayOfWeek ���ڼ�
리턴 System.DateTime

FromUnixTime() 공개 정적인 메소드

Returns the Unix based date as a DateTime object
public static FromUnixTime ( this date ) : System.DateTime
date this Unix date to convert
리턴 System.DateTime

GetDate() 공개 정적인 메소드

public static GetDate ( this dateTime ) : Date
dateTime this
리턴 System.Date

GetQuarter() 공개 정적인 메소드

ȡ�õ�ǰʱ�����ڵڣ�����
public static GetQuarter ( this date ) : int
date this
리턴 int

GetTime() 공개 정적인 메소드

public static GetTime ( this dateTime ) : Time
dateTime this
리턴 Time

IsDateEqual() 공개 정적인 메소드

�ж������Ƿ���ͬ������ʱ�䲿��
public static IsDateEqual ( this date, System.DateTime dateToCompare ) : bool
date this ����
dateToCompare System.DateTime ����
리턴 bool

IsFirstDayOfMonth() 공개 정적인 메소드

�ж��Ƿ�Ϊ���µ�һ��
public static IsFirstDayOfMonth ( this date ) : bool
date this
리턴 bool

IsInFuture() 공개 정적인 메소드

Determines if the date is some time in the future
public static IsInFuture ( this date ) : bool
date this Date to check
리턴 bool

IsInPast() 공개 정적인 메소드

Determines if the date is some time in the past
public static IsInPast ( this date ) : bool
date this Date to check
리턴 bool

IsLastDayOfMonth() 공개 정적인 메소드

�ж��Ƿ�Ϊ�������һ��
public static IsLastDayOfMonth ( this date ) : bool
date this
리턴 bool

IsLeapYear() 공개 정적인 메소드

public static IsLeapYear ( this date ) : bool
date this
리턴 bool

IsTimeEqual() 공개 정적인 메소드

�ж�ʱ���Ƿ���ͬ���������ڲ���
public static IsTimeEqual ( this time, System.DateTime timeToCompare ) : bool
time this ʱ��
timeToCompare System.DateTime ʱ��
리턴 bool

IsToday() 공개 정적인 메소드

Is this today?
public static IsToday ( this date ) : bool
date this Date to check
리턴 bool

IsWeekDay() 공개 정적인 메소드

Determines if this is a week day
public static IsWeekDay ( this date ) : bool
date this Date to check against
리턴 bool

IsWeekEnd() 공개 정적인 메소드

Determines if this is a week end
public static IsWeekEnd ( this date ) : bool
date this Date to check against
리턴 bool

IsWeekend() 공개 정적인 메소드

�ж��Ƿ�Ϊ��ĩ(����������)
public static IsWeekend ( this date ) : bool
date this ����
리턴 bool

LastDayOfMonth() 공개 정적인 메소드

Returns the last day of the month based on the date sent in
public static LastDayOfMonth ( this date ) : System.DateTime
date this Date to get the last day from
리턴 System.DateTime

LastDayOfQuarter() 공개 정적인 메소드

Returns the last day of a quarter based on the date sent in
public static LastDayOfQuarter ( this date, System.DateTime quarter1Start = default(DateTime) ) : System.DateTime
date this Date to get the last day of the quarter from
quarter1Start System.DateTime Beginning of the first quarter (defaults to the beginning of the year)
리턴 System.DateTime

LastDayOfWeek() 공개 정적인 메소드

ȡ�ñ��ܵ����һ��
public static LastDayOfWeek ( this date, CultureInfo cultureInfo = null ) : System.DateTime
date this ����
cultureInfo System.Globalization.CultureInfo �Ļ�
리턴 System.DateTime

LastDayOfYear() 공개 정적인 메소드

Returns the last day of the year based on the date sent in
public static LastDayOfYear ( this date ) : System.DateTime
date this Date to get the last day from
리턴 System.DateTime

LastWeekdayOfMonth() 공개 정적인 메소드

ȡ�õ��µ����һ�����ڼ�
public static LastWeekdayOfMonth ( this date, DayOfWeek dayOfWeek ) : System.DateTime
date this ����
dayOfWeek DayOfWeek ���ڼ�
리턴 System.DateTime

NextDayOfWeek() 공개 정적인 메소드

ȡ����һ�����ڼ�
public static NextDayOfWeek ( this currentDate, DayOfWeek weekday, bool includeCurrentDate = true ) : System.DateTime
currentDate this ����
weekday DayOfWeek ���ڼ�
includeCurrentDate bool ָ���Ƿ������ǰָ������
리턴 System.DateTime

PreviousWeekday() 공개 정적인 메소드

ȡ����һ�����ڼ�
public static PreviousWeekday ( this date, DayOfWeek weekday ) : System.DateTime
date this ����
weekday DayOfWeek ���ڼ�
리턴 System.DateTime

RelativeTime() 공개 정적인 메소드

Converts the DateTime object to string describing, relatively how long ago or how far in the future the input is based off of another DateTime object specified. ex: Input=March 21, 2013 Epoch=March 22, 2013 returns "1 day ago" Input=March 22, 2013 Epoch=March 21, 2013 returns "1 day from now"
public static RelativeTime ( this input, System.DateTime epoch ) : string
input this Input
epoch System.DateTime DateTime object that the input is comparred to
리턴 string

SetTime() 공개 정적인 메소드

Sets the time portion of a specific date
public static SetTime ( this date, System.TimeSpan time ) : System.DateTime
date this Date input
time System.TimeSpan Time to set
리턴 System.DateTime

SetTime() 공개 정적인 메소드

Sets the time portion of a specific date
public static SetTime ( this date, int hour, int minutes, int seconds ) : System.DateTime
date this Date input
hour int Hour to set
minutes int Minutes to set
seconds int Seconds to set
리턴 System.DateTime

TimeSpanSince1970() 공개 정적인 메소드

ȡ����1970-01-01����ʱ����
public static TimeSpanSince1970 ( this datetime ) : System.TimeSpan
datetime this
리턴 System.TimeSpan

ToDateTimeOffset() 공개 정적인 메소드

תDateTimeOffset
public static ToDateTimeOffset ( this localDateTime, TimeZoneInfo localTimeZone = null ) : DateTimeOffset
localDateTime this ����
localTimeZone System.TimeZoneInfo ʱ��
리턴 DateTimeOffset

ToUnix() 공개 정적인 메소드

Returns the date in Unix format
public static ToUnix ( this date ) : int
date this Date to convert
리턴 int

UTCOffset() 공개 정적인 메소드

Gets the UTC offset
public static UTCOffset ( this date ) : double
date this Date to get the offset of
리턴 double

WeeksOfYear() 공개 정적인 메소드

���ص�ǰ��ݵ���������
public static WeeksOfYear ( this dateTime, CultureInfo cultureInfo = null ) : int
dateTime this
cultureInfo System.Globalization.CultureInfo
리턴 int