MyChat Scripts Engine: JSONSetDateTime, setting the date/time in a JSON object
Setting or creating a value of the date/time key of a JSON object.
Syntax
function JSONSetDateTime(var sJSON: string; sKey: string; dtvalue: double): integer;
Parameters and return values
Parameter |
Type |
Value |
sJSON |
var string |
JSON object as a text string; |
sKey |
string |
required key name; |
dtValue |
double |
key value. |
Function result
0 |
no errors; |
1 |
JSON parsing error. |
Example
var
s: string;
dt: double;
begin
s := '{}'; // empty object for test
JSONSetDateTime(s, 'Today', Now); // creating the new key
JSONGetDateTime(s, 'Today', dt); // getting the key value
mLogScript('Today is: ' + FormatDateTime('dddd', dt), '');
end.
Script work result
[18:13:26] (Log "test"): Today is: Tuesday
See also
Created with the Personal Edition of HelpNDoc: Transform your help documentation into a stunning website