DIAdem Help

Method: CreateDateTime for JsonParser

  • Updated2024-09-12
  • 1 minute(s) read

Method: CreateDateTime for JsonParser

Converts a VBS variable with the subtype Date into a date according to ISO 8601.

sCreateDateTime = Object.CreateDateTime(Date, LocalTime)
ObjectJsonParser
Object with this method
DateObject
Specifies a VBS variable with the subtype Date.
LocalTimeBoolean
Specifies whether the method interprets the time as local time (TRUE) or as coordinated Universal Time (UTC) (FALSE).
sCreateDateTimeString
Receives the date specification according to ISO 8601.

The following example creates a date from a VBS date/time value according to ISO 8601 within a JSON object and displays the content of the JSON object in the log area.

VBScriptPython

 

Dim oJsonParser, oMyDict, sJsonDateTimeTag
Set oJsonParser = CreateJsonParser()
Set oMyDict = CreateObject("Scripting.Dictionary")
Call oMyDict.Add("timestamp", oJsonParser.CreateDateTime(Now,True))
sJsonDateTimeTag = oJsonParser.Serialize(oMyDict, True)
Call LogFileWrite(sJsonDateTimeTag)

Log in to get a better experience