JsonPrimitive Constructor (DateTime)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Initializes a new instance of a JsonPrimitive type with a DateTime type.

Namespace:  System.Json
Assembly:  System.Json (in System.Json.dll)

Syntax

'Declaration
Public Sub New ( _
    value As DateTime _
)
public JsonPrimitive(
    DateTime value
)

Parameters

Remarks

A JsonPrimitive object stores a JsonType and the value used to initialize it. When initialized with a DateTime object, the JsonType is a String, which can be recovered using the JsonType property. The value used to initialize the JsonPrimitive object can be recovered using the ToString() method.

Examples

            'Initialize JSON primitive with a DateTime.
            Dim datetime As New DateTime(300)
            Dim jsonP3 As New JsonPrimitive(datetime)
//Initialize JSON primitive with a DateTime.
DateTime datetime = new DateTime(300);
JsonPrimitive jsonP3 = new JsonPrimitive(datetime);

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.