MQL4参考 函数转换 TimeToStr

TimeToStr

Converts value containing time in seconds that has passed since January 1, 1970, into a string of "yyyy.mm.dd hh:mi" format.

string  TimeToStr(
   datetime  value,                           // value
   int       mode=TIME_DATE|TIME_MINUTES      // format
   );

Parameters

value

[in]  Positive amount of seconds that have passed since 00:00, January 1, 1970.

mode=TIME_DATE|TIME_MINUTES

[in]  Optional data output mode can be one or combination of:
TIME_DATE gets result as "yyyy.mm.dd",
TIME_MINUTES gets result as "hh:mi",
TIME_SECONDS gets result as "hh:mi:ss".

Returned value

String.

Example:

  string var1=TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);

See also

PrintFormat(), StrToTime(), StringToTime()