Changing time and date format in mql4

Back to topics list  | 1 2 To post a new topic, please log in or register
abdI 2013.04.19 15:27 #

WHRoeder ........thanks .....going to tray your code........

thanks again  

RaptorUK 2013.04.19 15:39 #
  1. RaptorUK: You can construct the string using  StringConcatenate(int, int, int, int, )  with  TimeYear(TimeCurrent() )  TimeMonth(TimeCurrent)  TimeDay(TimeCurrent)  etc.
    Using TimeMonth(x), etc., will not result is 2 digit values but instead yyyymd hm in general.
It's easy enough to add the leading "0"

deVries 2013.04.19 15:59 #

 and here what i found in the log file



15:29:32 #time EURUSD,Daily:   Time  1366385328
15:29:32 #time EURUSD,Daily:   Time  1366385328

Type datetime

The value of datetime type is the values of date and time.

The values of this type can be used in programs to analyze the moment of beginning or ending of some events, including the releases of important news, workday start/finish, etc. The constants of date and time can be represented as a literal line consisting of 6 parts that represent the numeric value of year, month, day (or day, month, year), hour, minute, and second.

The constant is framed in single quotes and starts with 'D'. It is allowed to use truncated values: either without date or without time, or just an empty value. The range of values: from January 1, 1970, to December 31, 2037. The values of constants and variables of datetime type take 4 bytes in the computer memory. A value represents the amount of seconds elapsed from 00:00 of the 1st of January 1970.

An example of using a variable of datetime type in a program:

datetime Alfa    = D'2004.01.01 00:00';       // New Year
datetime Tim     = D'01.01.2004';             // New Year
datetime Tims    = D'2005.05.12 16:30:45';    // May 12, 2005 4:30:45 p.m.
datetime N_3     = D'12.05.2005 16:30:45';    // May 12, 2005 4:30:45 p.m. 
datetime Compile = D'';                       // equivalent of D'[compilation date] 
					      //			00:00:00'

and after getting the time format as the above then i can  do any mathematical operations on it by considering it to be a (number)  not (date) 


As you can see time is like a counting of seconds from January 1, 1970, to December 31, 2037 

isn't it be easier to make use of datetime to do mathematical operations ??? 




RaptorUK 2013.04.19 16:04 #

isn't it be easier to make use of datetime to do mathematical operations ???  

That depends.  If the OP wants to do manual calculations then no,  if the OP wants to use the datetime in further code then yes.

krishnap2w2 2014.11.24 10:04 #

I have encountered a similar problem with Screen Update. I resolved it. I attachment has the solution with screenshots.


Back to topics list   | 1 2  

To add comments, please log in or register