Serialization support for DateTimeOffset.
This commit is contained in:
parent
3fd844cfa0
commit
26899493c0
2 changed files with 40 additions and 0 deletions
|
|
@ -555,6 +555,23 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
public static DateTimeOffset GetXMLDateTimeOffset( string dateTimeOffsetString, DateTimeOffset defaultValue )
|
||||
{
|
||||
try
|
||||
{
|
||||
return XmlConvert.ToDateTimeOffset( dateTimeOffsetString );
|
||||
}
|
||||
catch
|
||||
{
|
||||
DateTimeOffset d;
|
||||
|
||||
if( DateTimeOffset.TryParse( dateTimeOffsetString, out d ) )
|
||||
return d;
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static TimeSpan GetXMLTimeSpan( string timeSpanString, TimeSpan defaultValue )
|
||||
{
|
||||
try
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue