Method: CreateDateTime for JsonParser
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: CreateDateTime for JsonParser
Method: CreateDateTime for JsonParser
Converts a VBS variable with the subtype Date into a date according to ISO 8601.
sCreateDateTime = Object.CreateDateTime(Date, LocalTime)
| Object | JsonParser Object with this method |
| Date | Object Specifies a VBS variable with the subtype Date. |
| LocalTime | Boolean Specifies whether the method interprets the time as local time (TRUE) or as coordinated Universal Time (UTC) (FALSE). |
| sCreateDateTime | String 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.
| VBScript | Python |
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)