Download MetaTrader 5
To add comments, please log in or register
How to earn at MQL5.community? Come and find out!
gangsta1
1172
gangsta1 2014.02.04 17:52 

I am trying to print the times to my chart but the format is not correct:

Log:

2014.02.04 17:47:29.079 Expert Time Check EURUSD H1: Local Time Is.1391536049 GMT Time Is.1391536049 Current Time Is.1391543240

Code:

      Comment("Local Time Is." + TimeLocal(), "GMT Time Is." + TimeGMT(), "Current Time Is." + TimeCurrent());

Yesterday this as displaying as say 17:51 which is the correct format but for some reason today its displaying like this.

Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2014.02.04 17:54  
gangsta1:

I am trying to print the times to my chart but the format is not correct:

Log:

2014.02.04 17:47:29.079 Expert Time Check EURUSD H1: Local Time Is.1391536049 GMT Time Is.1391536049 Current Time Is.1391543240

Code:

Yesterday this as displaying as say 17:51 which is the correct format but for some reason today its displaying like this.

I would expect it to show the datetime . . . so what you get today is correct in my opinion. Use TimeToString() with TIME_MINUTES

Edit: Ah, I guess it may be because of the + that it formatted to minutes . . .

gangsta1
1172
gangsta1 2014.02.04 18:04  
Thank you Raptor, this solved it, the + was not an issue.
string var1=TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);
/
To add comments, please log in or register