MQL4 Reference Conversion Functions StrToTime

StrToTime

Converts string in the format "yyyy.mm.dd hh:mi" to datetime type (the amount of seconds that have passed since 1 Jan., 1970).

datetime  StrToTime(
   string  value      // string
   );

Parameters

value

[in]  String having "yyyy.mm.dd hh:mi " format.

Returned value

Value of datetime type as a number of seconds, passed since 01.01.1970.

Example:

  datetime var1,var2,var3;
  var1=StrToTime("2003.8.12 17:35");
  var2=StrToTime("17:35");      // returns the current date with the given time
  var3=StrToTime("2003.8.12");  // returns the date with the midnight time of "00:00"

See also

PrintFormat(), TimeToStr(), TimeToString()