MyChat Scripts: function StrMyChatToDateTime, convert the date/time text string of MyChat format into double format
"For developers", "Server scripts", "Functions description", "Converting types", "StrMyChatToDateTime".
Convert MyChat text string (dd.mm.yyyy.hh.nn.ss) into the number with the floating point of double format.
Syntax
function StrMyChatToDateTime(const sDate: string): double;
Parameters and return values
Parameter |
Type |
Value |
sDate |
string |
date/time text representation in MyChat format. |
Function result
The number in double format. If you send an empty or incorrect string, the function returns NODATE-value.
Example
const
MYCHAT_BIRTHDAY = '13.05.2004.03.14.15';
var
dt: double;
begin
dt := StrMyChatToDateTime(MYCHAT_BIRTHDAY);
mLogScript(FormatDateTime('d (ddd) mmm yyyy hh:nn:ss', dt), '');
end.
Script work result
[12:48:11] (Log "StrMyChatToDateTime"): 13 (Th) May 2004 03:14:15
[12:48:11] (Run "StrMyChatToDateTime"): Script operation time: 7 ms
[12:48:11] (Run "StrMyChatToDateTime"): Script done successfully.