Class JsonDate
Inheritance
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 |
---|---|
System.Double |
Methods
GetTime(DateTime)
Declaration
public static double GetTime(DateTime tDate)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | tDate | Either a local time or an UTC time. |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.String | sDate | String date to convert. If this is |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.String | sDate | String date to convert. If this is |
System.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 |
---|---|
System.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 |
---|---|---|
System.Double | nMilliseconds | Milliseonds to convert. If this is zero, then |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.Double | nMilliseconds |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.DateTime | tDate | The date value to convert. |
Returns
Type | Description |
---|---|
System.String | If the parameter is |
ToDateTimeString(DateTime)
Declaration
public static string ToDateTimeString(DateTime tDate)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | tDate |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.DateTime | tDate | The date value to convert. |
Returns
Type | Description |
---|---|
System.String | If the parameter is |