DateTimeExtensions
A fast, standards-based, serialization-issue free DateTime serializer.
Assembly: ServiceStack.Text.dll
View Source
Declaration
public static class DateTimeExtensions
Fields
UnixEpoch
View Source
Declaration
public const long UnixEpoch = 621355968000000000L
Methods
FromUnixTime(Int32)
View Source
Declaration
public static DateTime FromUnixTime(this int unixTime)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Int32 | unixTime |
FromUnixTime(Double)
View Source
Declaration
public static DateTime FromUnixTime(this double unixTime)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Double | unixTime |
FromUnixTime(Int64)
View Source
Declaration
public static DateTime FromUnixTime(this long unixTime)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Int64 | unixTime |
ToUnixTimeMsAlt(DateTime)
View Source
Declaration
public static long ToUnixTimeMsAlt(this DateTime dateTime)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
ToUnixTimeMs(DateTimeOffset)
View Source
Declaration
public static long ToUnixTimeMs(this DateTimeOffset dateTimeOffset)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.DateTimeOffset | dateTimeOffset |
ToUnixTimeMs(DateTime)
View Source
Declaration
public static long ToUnixTimeMs(this DateTime dateTime)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
ToUnixTime(DateTime)
View Source
Declaration
public static long ToUnixTime(this DateTime dateTime)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
ToUnixTimeMs(Int64)
View Source
Declaration
public static long ToUnixTimeMs(this long ticks)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.Int64 | ticks |
FromUnixTimeMs(Double)
View Source
Declaration
public static DateTime FromUnixTimeMs(this double msSince1970)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Double | msSince1970 |
FromUnixTimeMs(Int64)
View Source
Declaration
public static DateTime FromUnixTimeMs(this long msSince1970)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Int64 | msSince1970 |
FromUnixTimeMs(Int64, TimeSpan)
View Source
Declaration
public static DateTime FromUnixTimeMs(this long msSince1970, TimeSpan offset)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Int64 | msSince1970 |
System.TimeSpan | offset |
FromUnixTimeMs(Double, TimeSpan)
View Source
Declaration
public static DateTime FromUnixTimeMs(this double msSince1970, TimeSpan offset)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Double | msSince1970 |
System.TimeSpan | offset |
FromUnixTimeMs(String)
View Source
Declaration
public static DateTime FromUnixTimeMs(string msSince1970)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.String | msSince1970 |
FromUnixTimeMs(String, TimeSpan)
View Source
Declaration
public static DateTime FromUnixTimeMs(string msSince1970, TimeSpan offset)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.String | msSince1970 |
System.TimeSpan | offset |
RoundToMs(DateTime)
View Source
Declaration
public static DateTime RoundToMs(this DateTime dateTime)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
RoundToSecond(DateTime)
View Source
Declaration
public static DateTime RoundToSecond(this DateTime dateTime)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
Truncate(DateTime, TimeSpan)
View Source
Declaration
public static DateTime Truncate(this DateTime dateTime, TimeSpan timeSpan)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
System.TimeSpan | timeSpan |
ToShortestXsdDateTimeString(DateTime)
View Source
Declaration
public static string ToShortestXsdDateTimeString(this DateTime dateTime)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
FromShortestXsdDateTimeString(String)
View Source
Declaration
public static DateTime FromShortestXsdDateTimeString(this string xsdDateTime)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.String | xsdDateTime |
IsEqualToTheSecond(DateTime, DateTime)
View Source
Declaration
public static bool IsEqualToTheSecond(this DateTime dateTime, DateTime otherDateTime)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
System.DateTime | otherDateTime |
ToTimeOffsetString(TimeSpan, String)
View Source
Declaration
public static string ToTimeOffsetString(this TimeSpan offset, string seperator = "")
Returns
System.String
Parameters
Type | Name |
---|---|
System.TimeSpan | offset |
System.String | seperator |
FromTimeOffsetString(String)
View Source
Declaration
public static TimeSpan FromTimeOffsetString(this string offsetString)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
System.String | offsetString |
ToStableUniversalTime(DateTime)
View Source
Declaration
public static DateTime ToStableUniversalTime(this DateTime dateTime)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
FmtSortableDate(DateTime)
View Source
Declaration
public static string FmtSortableDate(this DateTime from)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTime | from |
FmtSortableDateTime(DateTime)
View Source
Declaration
public static string FmtSortableDateTime(this DateTime from)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTime | from |
LastMonday(DateTime)
View Source
Declaration
public static DateTime LastMonday(this DateTime from)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.DateTime | from |
StartOfLastMonth(DateTime)
View Source
Declaration
public static DateTime StartOfLastMonth(this DateTime from)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.DateTime | from |
EndOfLastMonth(DateTime)
View Source
Declaration
public static DateTime EndOfLastMonth(this DateTime from)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.DateTime | from |