DateTimeSerializer
Assembly: ServiceStack.Text.dll
View Source
Declaration
public static class DateTimeSerializer
Properties
OnParseErrorFn
View Source
Declaration
public static Func<string, Exception, DateTime> OnParseErrorFn { get; set; }
Fields
CondensedDateTimeFormat
View Source
Declaration
public const string CondensedDateTimeFormat = "yyyyMMdd"
ShortDateTimeFormat
View Source
Declaration
public const string ShortDateTimeFormat = "yyyy-MM-dd"
DefaultDateTimeFormat
View Source
Declaration
public const string DefaultDateTimeFormat = "dd/MM/yyyy HH:mm:ss"
DefaultDateTimeFormatWithFraction
View Source
Declaration
public const string DefaultDateTimeFormatWithFraction = "dd/MM/yyyy HH:mm:ss.fff"
XsdDateTimeFormat
View Source
Declaration
public const string XsdDateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"
XsdDateTimeFormat3F
View Source
Declaration
public const string XsdDateTimeFormat3F = "yyyy-MM-ddTHH:mm:ss.fffZ"
XsdDateTimeFormatSeconds
View Source
Declaration
public const string XsdDateTimeFormatSeconds = "yyyy-MM-ddTHH:mm:ssZ"
DateTimeFormatSecondsUtcOffset
View Source
Declaration
public const string DateTimeFormatSecondsUtcOffset = "yyyy-MM-ddTHH:mm:sszzz"
DateTimeFormatSecondsNoOffset
View Source
Declaration
public const string DateTimeFormatSecondsNoOffset = "yyyy-MM-ddTHH:mm:ss"
DateTimeFormatTicksUtcOffset
View Source
Declaration
public const string DateTimeFormatTicksUtcOffset = "yyyy-MM-ddTHH:mm:ss.fffffffzzz"
DateTimeFormatTicksNoUtcOffset
View Source
Declaration
public const string DateTimeFormatTicksNoUtcOffset = "yyyy-MM-ddTHH:mm:ss.fffffff"
EscapedWcfJsonPrefix
View Source
Declaration
public const string EscapedWcfJsonPrefix = "\\/Date("
EscapedWcfJsonSuffix
View Source
Declaration
public const string EscapedWcfJsonSuffix = ")\\/"
WcfJsonPrefix
View Source
Declaration
public const string WcfJsonPrefix = "/Date("
WcfJsonSuffix
View Source
Declaration
public const char WcfJsonSuffix = ')'
UnspecifiedOffset
View Source
Declaration
public const string UnspecifiedOffset = "-0000"
UtcOffset
View Source
Declaration
public const string UtcOffset = "+0000"
Methods
Prepare(DateTime, Boolean)
If AlwaysUseUtc is set to true then convert all DateTime to UTC. If PreserveUtc is set to true then UTC dates will not convert to local
View Source
Declaration
public static DateTime Prepare(this DateTime dateTime, bool parsedAsUtc = false)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
System.Boolean | parsedAsUtc |
ParseShortestNullableXsdDateTime(String)
View Source
Declaration
public static DateTime? ParseShortestNullableXsdDateTime(string dateTimeStr)
Returns
System.Nullable<System.DateTime>
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseRFC1123DateTime(String)
View Source
Declaration
public static DateTime ParseRFC1123DateTime(string dateTimeStr)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseShortestXsdDateTime(String)
View Source
Declaration
public static DateTime ParseShortestXsdDateTime(string dateTimeStr)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseManual(String)
View Source
Declaration
public static DateTime? ParseManual(string dateTimeStr)
Returns
System.Nullable<System.DateTime>
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseManual(String, DateTimeKind)
View Source
Declaration
public static DateTime? ParseManual(string dateTimeStr, DateTimeKind dateKind)
Returns
System.Nullable<System.DateTime>
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
System.DateTimeKind | dateKind |
ToDateTimeString(DateTime)
View Source
Declaration
public static string ToDateTimeString(DateTime dateTime)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
ParseDateTime(String)
View Source
Declaration
public static DateTime ParseDateTime(string dateTimeStr)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseDateTimeOffset(String)
View Source
Declaration
public static DateTimeOffset ParseDateTimeOffset(string dateTimeOffsetStr)
Returns
System.DateTimeOffset
Parameters
Type | Name |
---|---|
System.String | dateTimeOffsetStr |
ParseNullableDateTimeOffset(String)
View Source
Declaration
public static DateTimeOffset? ParseNullableDateTimeOffset(string dateTimeOffsetStr)
Returns
System.Nullable<System.DateTimeOffset>
Parameters
Type | Name |
---|---|
System.String | dateTimeOffsetStr |
ToXsdDateTimeString(DateTime)
View Source
Declaration
public static string ToXsdDateTimeString(DateTime dateTime)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
ToLocalXsdDateTimeString(DateTime)
View Source
Declaration
public static string ToLocalXsdDateTimeString(DateTime dateTime)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
ToXsdTimeSpanString(TimeSpan)
View Source
Declaration
public static string ToXsdTimeSpanString(TimeSpan timeSpan)
Returns
System.String
Parameters
Type | Name |
---|---|
System.TimeSpan | timeSpan |
ToXsdTimeSpanString(Nullable<TimeSpan>)
View Source
Declaration
public static string ToXsdTimeSpanString(TimeSpan? timeSpan)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Nullable<System.TimeSpan> | timeSpan |
ParseXsdDateTime(String)
View Source
Declaration
public static DateTime ParseXsdDateTime(string dateTimeStr)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseTimeSpan(String)
View Source
Declaration
public static TimeSpan ParseTimeSpan(string dateTimeStr)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseNSTimeInterval(String)
View Source
Declaration
public static TimeSpan ParseNSTimeInterval(string doubleInSecs)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
System.String | doubleInSecs |
ParseNullableTimeSpan(String)
View Source
Declaration
public static TimeSpan? ParseNullableTimeSpan(string dateTimeStr)
Returns
System.Nullable<System.TimeSpan>
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseXsdTimeSpan(String)
View Source
Declaration
public static TimeSpan ParseXsdTimeSpan(string dateTimeStr)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ParseXsdNullableTimeSpan(String)
View Source
Declaration
public static TimeSpan? ParseXsdNullableTimeSpan(string dateTimeStr)
Returns
System.Nullable<System.TimeSpan>
Parameters
Type | Name |
---|---|
System.String | dateTimeStr |
ToShortestXsdDateTimeString(DateTime)
View Source
Declaration
public static string ToShortestXsdDateTimeString(DateTime dateTime)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
ParseWcfJsonDateOffset(String)
WCF Json format: /Date(unixts+0000)/
View Source
Declaration
public static DateTimeOffset ParseWcfJsonDateOffset(string wcfJsonDate)
Returns
System.DateTimeOffset
Parameters
Type | Name |
---|---|
System.String | wcfJsonDate |
ParseWcfJsonDate(String)
WCF Json format: /Date(unixts+0000)/
View Source
Declaration
public static DateTime ParseWcfJsonDate(string wcfJsonDate)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.String | wcfJsonDate |
GetLocalTimeZoneInfo()
View Source
Declaration
public static TimeZoneInfo GetLocalTimeZoneInfo()
Returns
System.TimeZoneInfo
WriteWcfJsonDate(TextWriter, DateTime)
View Source
Declaration
public static void WriteWcfJsonDate(TextWriter writer, DateTime dateTime)
Parameters
Type | Name |
---|---|
System.IO.TextWriter | writer |
System.DateTime | dateTime |
ToWcfJsonDate(DateTime)
View Source
Declaration
public static string ToWcfJsonDate(DateTime dateTime)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
WriteWcfJsonDateTimeOffset(TextWriter, DateTimeOffset)
View Source
Declaration
public static void WriteWcfJsonDateTimeOffset(TextWriter writer, DateTimeOffset dateTimeOffset)
Parameters
Type | Name |
---|---|
System.IO.TextWriter | writer |
System.DateTimeOffset | dateTimeOffset |
ToWcfJsonDateTimeOffset(DateTimeOffset)
View Source
Declaration
public static string ToWcfJsonDateTimeOffset(DateTimeOffset dateTimeOffset)
Returns
System.String
Parameters
Type | Name |
---|---|
System.DateTimeOffset | dateTimeOffset |