C# 클래스 fCraft.DateTimeUtil

Provides utility functions for working with DateTime and TimeSpan.
파일 보기 프로젝트 열기: fragmer/fCraft 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
MaxTimeSpan System.TimeSpan
UnixEpoch System.DateTime

공개 메소드들

메소드 설명
ParseMiniTimeSpan ( [ text ) : System.TimeSpan

Parses the given string as a TimeSpan in compact representation. Throws exceptions on failure.

ParseMiniTimespan ( [ text ) : System.TimeSpan

Parses the given string as a TimeSpan in compact representation. Throws exceptions on failure.

ToDateTime ( long timestamp ) : System.DateTime

Creates a DateTime from a UTC Unix Timestamp.

ToDateTime ( this timestamp ) : System.DateTime

Creates a DateTime from a Utc Unix Timestamp.

ToDateTime ( this str, System.DateTime &result ) : bool

Tries to create a DateTime from a string containing a Utc Unix Timestamp. If the string was empty, returns false and does not affect result.

ToDateTimeLegacy ( this str, System.DateTime &result ) : bool
ToSeconds ( this time ) : long
ToSecondsString ( this time, [ sb ) : void

Serializes the given TimeSpan to the given StringBuilder, as the number of seconds.

ToTickString ( this time, StringBuilder sb ) : StringBuilder
ToTimeSpan ( [ str, System.TimeSpan &result ) : bool

Tries to create a TimeSpan from a string containing the number of seconds. If the string was empty, returns false and sets result to TimeSpan.Zero

ToTimeSpanLegacy ( this str, System.TimeSpan &result ) : bool
ToUnixTime ( this date ) : long

Converts a DateTime to UTC Unix Timestamp.

ToUnixTimeString ( this date, StringBuilder sb ) : StringBuilder

Appends a Utc Unix Timestamp to the given StringBuilder. If the date equals DateTime.MinValue, nothing is appended.

TryParseDateTime ( long timestamp ) : System.DateTime

Creates a DateTime from a UTC Unix Timestamp.

TryParseDateTime ( [ str, System.DateTime &result ) : bool

Tries to create a DateTime from a string containing a Utc Unix Timestamp. If the string was empty, returns false and does not affect result.

TryParseMiniTimeSpan ( [ text, System.TimeSpan &result ) : bool

Attempts to parse the given string as a TimeSpan in compact representation. No exception is thrown if parsing failed.

TryParseMiniTimespan ( [ text, System.TimeSpan &result ) : bool

Attempts to parse the given string as a TimeSpan in compact representation. No exception is thrown if parsing failed.

TryParseMiniTimespan ( this text, System.TimeSpan &result ) : bool
TryParseTimeSpan ( [ str, System.TimeSpan &result ) : bool

Tries to create a TimeSpan from a string containing the number of seconds. If the string was empty, returns false and sets result to TimeSpan.Zero

비공개 메소드들

메소드 설명
DateTimeUtil ( ) : System
ToCompactString ( this date ) : string
ToDateTimeLegacy ( long timestamp ) : System.DateTime
ToDateTimeLegacy ( [ str, System.DateTime &result ) : bool
ToMiniString ( this span ) : string
ToSecondsString ( this time ) : string
ToTickString ( this time, [ sb ) : StringBuilder
ToTickString ( this time ) : string
ToTimeSpanLegacy ( [ str, System.TimeSpan &result ) : bool
ToUnixTimeLegacy ( this date ) : long
ToUnixTimeString ( this date, [ sb ) : StringBuilder
ToUnixTimeString ( this date ) : string
TryParseLocalDate ( [ dateString, System.DateTime &date ) : bool

메소드 상세

ParseMiniTimeSpan() 공개 정적인 메소드

Parses the given string as a TimeSpan in compact representation. Throws exceptions on failure.
text is null. The resulting TimeSpan is greater than TimeSpan.MaxValue. input has an invalid format.
public static ParseMiniTimeSpan ( [ text ) : System.TimeSpan
text [ String to parse.
리턴 System.TimeSpan

ParseMiniTimespan() 공개 정적인 메소드

Parses the given string as a TimeSpan in compact representation. Throws exceptions on failure.
text is null. The resulting TimeSpan is greater than TimeSpan.MaxValue. input has an invalid format.
public static ParseMiniTimespan ( [ text ) : System.TimeSpan
text [ String to parse.
리턴 System.TimeSpan

ToDateTime() 공개 정적인 메소드

Creates a DateTime from a UTC Unix Timestamp.
public static ToDateTime ( long timestamp ) : System.DateTime
timestamp long
리턴 System.DateTime

ToDateTime() 공개 정적인 메소드

Creates a DateTime from a Utc Unix Timestamp.
public static ToDateTime ( this timestamp ) : System.DateTime
timestamp this
리턴 System.DateTime

ToDateTime() 공개 정적인 메소드

Tries to create a DateTime from a string containing a Utc Unix Timestamp. If the string was empty, returns false and does not affect result.
public static ToDateTime ( this str, System.DateTime &result ) : bool
str this
result System.DateTime
리턴 bool

ToDateTimeLegacy() 공개 정적인 메소드

public static ToDateTimeLegacy ( this str, System.DateTime &result ) : bool
str this
result System.DateTime
리턴 bool

ToSeconds() 공개 정적인 메소드

public static ToSeconds ( this time ) : long
time this
리턴 long

ToSecondsString() 공개 정적인 메소드

Serializes the given TimeSpan to the given StringBuilder, as the number of seconds.
sb is null.
public static ToSecondsString ( this time, [ sb ) : void
time this TimeSpan to serialize.
sb [ StringBuilder to which time will be saved.
리턴 void

ToTickString() 공개 정적인 메소드

public static ToTickString ( this time, StringBuilder sb ) : StringBuilder
time this
sb StringBuilder
리턴 StringBuilder

ToTimeSpan() 공개 정적인 메소드

Tries to create a TimeSpan from a string containing the number of seconds. If the string was empty, returns false and sets result to TimeSpan.Zero
public static ToTimeSpan ( [ str, System.TimeSpan &result ) : bool
str [
result System.TimeSpan
리턴 bool

ToTimeSpanLegacy() 공개 정적인 메소드

public static ToTimeSpanLegacy ( this str, System.TimeSpan &result ) : bool
str this
result System.TimeSpan
리턴 bool

ToUnixTime() 공개 정적인 메소드

Converts a DateTime to UTC Unix Timestamp.
public static ToUnixTime ( this date ) : long
date this
리턴 long

ToUnixTimeString() 공개 정적인 메소드

Appends a Utc Unix Timestamp to the given StringBuilder. If the date equals DateTime.MinValue, nothing is appended.
public static ToUnixTimeString ( this date, StringBuilder sb ) : StringBuilder
date this
sb StringBuilder
리턴 StringBuilder

TryParseDateTime() 공개 정적인 메소드

Creates a DateTime from a UTC Unix Timestamp.
public static TryParseDateTime ( long timestamp ) : System.DateTime
timestamp long
리턴 System.DateTime

TryParseDateTime() 공개 정적인 메소드

Tries to create a DateTime from a string containing a Utc Unix Timestamp. If the string was empty, returns false and does not affect result.
public static TryParseDateTime ( [ str, System.DateTime &result ) : bool
str [
result System.DateTime
리턴 bool

TryParseMiniTimeSpan() 공개 정적인 메소드

Attempts to parse the given string as a TimeSpan in compact representation. No exception is thrown if parsing failed.
text is null.
public static TryParseMiniTimeSpan ( [ text, System.TimeSpan &result ) : bool
text [ String to parse.
result System.TimeSpan Parsed TimeSpan. Set to TimeSpan.Zero if parsing failed.
리턴 bool

TryParseMiniTimespan() 공개 정적인 메소드

Attempts to parse the given string as a TimeSpan in compact representation. No exception is thrown if parsing failed.
text is null.
public static TryParseMiniTimespan ( [ text, System.TimeSpan &result ) : bool
text [ String to parse.
result System.TimeSpan Parsed TimeSpan. Set to TimeSpan.Zero if parsing failed.
리턴 bool

TryParseMiniTimespan() 공개 정적인 메소드

public static TryParseMiniTimespan ( this text, System.TimeSpan &result ) : bool
text this
result System.TimeSpan
리턴 bool

TryParseTimeSpan() 공개 정적인 메소드

Tries to create a TimeSpan from a string containing the number of seconds. If the string was empty, returns false and sets result to TimeSpan.Zero
str is null
public static TryParseTimeSpan ( [ str, System.TimeSpan &result ) : bool
str [
result System.TimeSpan
리턴 bool

프로퍼티 상세

MaxTimeSpan 공개적으로 정적으로 프로퍼티

Longest reasonable value that fCraft will allow to be entered for time spans (9999 days).
public static TimeSpan,System MaxTimeSpan
리턴 System.TimeSpan

UnixEpoch 공개적으로 정적으로 프로퍼티

UTC Unix epoch (1970-01-01, 00:00:00).
public static DateTime,System UnixEpoch
리턴 System.DateTime