MQL4 Reference Language Basics Data Types Integer Types Datetime Type
Datetime TypeThe datetime type is intended for storing the date and time as the number of seconds elapsed since January 01, 1970. This type occupies 8 bytes of memory. Constants of the date and time can be represented as a literal string, which consists of 6 parts showing the numerical value of the year, month, day (or day, month, year), hours, minutes and seconds. The constant is enclosed in single quotation marks and starts with the D character. Values range from 1 January, 1970 to 31 December, 3000. Either date (year , month, day) or time (hours, minutes, seconds), or all together can be omitted. With literal date specification, it is desirable that you specify year, month and day. Otherwise the compiler returns a warning about an incomplete entry. Examples:
The string representation of datetime type depends on compilation mode:
See also Structure of the Date Type, Date and Time, TimeToString, StringToTime |