Class JsonDate
Inherited Members
Namespace: Subsembly.Json
Assembly: Subsembly.Json.dll
Syntax
public static class JsonDate
Properties
Now
Declaration
public static double Now { get; }
Property Value
Type | Description |
---|---|
double |
Methods
GetTime(DateTime)
Declaration
public static double GetTime(DateTime tDate)
Parameters
Type | Name | Description |
---|---|---|
DateTime | tDate | Either a local time or an UTC time. |
Returns
Type | Description |
---|---|
double | Number of milliseconds since 1970-01-01 UTC. If the given date was
|
Parse(string)
Converts a JSON string representation of a date to a DateTime
value.
Declaration
public static DateTime Parse(string sDate)
Parameters
Type | Name | Description |
---|---|---|
string | sDate | String date to convert. If this is |
Returns
Type | Description |
---|---|
DateTime |
Remarks
Valid formats include "yyyy-MM-ddTHH:mm:ss.fffffffK" and its subsets.
Parse(string, DateTimeKind)
Converts a JSON string representation of a date to a DateTime
value.
Declaration
public static DateTime Parse(string sDate, DateTimeKind nDateTimeKindDefault)
Parameters
Type | Name | Description |
---|---|---|
string | sDate | String date to convert. If this is |
DateTimeKind | nDateTimeKindDefault | Default DateTimeKind which is used, if parsed DateTime.Kind equals DateTimeKind.Unspecified. A value of DateTimeKind.Unspecified is here useless. |
Returns
Type | Description |
---|---|
DateTime |
Remarks
Valid formats include "yyyy-MM-ddTHH:mm:ss.fffffffK" and its subsets.
SetTime(double)
Converts milliseconds since 1970-01-01 UTC to a DateTime
in local time.
Declaration
public static DateTime SetTime(double nMilliseconds)
Parameters
Type | Name | Description |
---|---|---|
double | nMilliseconds | Milliseonds to convert. If this is zero, then |
Returns
Type | Description |
---|---|
DateTime |
SetTimeUtc(double)
Converts milliseconds since 1970-01-01 UTC to a DateTime
UTC value.
Declaration
public static DateTime SetTimeUtc(double nMilliseconds)
Parameters
Type | Name | Description |
---|---|---|
double | nMilliseconds |
Returns
Type | Description |
---|---|
DateTime | A |
ToDateString(DateTime)
Converts a DateTime
value to a JSON string representation of a date.
Declaration
public static string ToDateString(DateTime tDate)
Parameters
Type | Name | Description |
---|---|---|
DateTime | tDate | The date value to convert. |
Returns
Type | Description |
---|---|
string | If the parameter is |
ToDateTimeString(DateTime)
Declaration
public static string ToDateTimeString(DateTime tDate)
Parameters
Type | Name | Description |
---|---|---|
DateTime | tDate |
Returns
Type | Description |
---|---|
string |
ToISOString(DateTime)
Converts a DateTime
value to a JSON string representation of a date.
Declaration
public static string ToISOString(DateTime tDate)
Parameters
Type | Name | Description |
---|---|---|
DateTime | tDate | The date value to convert. |
Returns
Type | Description |
---|---|
string | If the parameter is |