MyChat Scripts: function DateTimeToISOStr for converting date and time into ISO string
Convert the value of the date/time (double) into an ISO string (yyyy-mm-dd hh:nn:ss).
Syntax
function DateTimeToISOStr(const dt: double): string;
Parameters and return values
Parameter |
Type |
Value |
dt |
double |
real number date and type. |
Function result
ISO text string.
Example
var
i: integer;
dt: double;
begin
for i := 1 to 5 do begin
dt := IncDay(Now, Random(10000) - 5000);
mLogScript(DateTimeToISOStr(dt), '');
end;
end.
Script work result
[20:13:23] (Log "DateTimeToISOStr"): 2018-08-20 20:13:23
[20:13:23] (Log "DateTimeToISOStr"): 2023-10-04 20:13:23
[20:13:23] (Log "DateTimeToISOStr"): 2017-12-28 20:13:23
[20:13:23] (Log "DateTimeToISOStr"): 2016-10-05 20:13:23
[20:13:23] (Log "DateTimeToISOStr"): 2031-09-18 20:13:23
[20:13:23] (Run "DateTimeToISOStr"): Sc operation time: 2 ms
[20:13:23] (Run "DateTimeToISOStr"): Script done successfully.