Convert to Date and Time
If you're happy to accept their format, take a look at TimeToString().
Otherwise, take a look at the MqlDateTime structure and TimeToStruct() which will give more flexibility on the output format.
Depends really on what you plan to do with the data, and the context of your question.
waterhorse: MT4 date to regular date i.e. day/month/year
-
honest_knave: TimeToString().
- variations like
string DDMMYYYY(datetime d){ // 01/01/2015 return Stringformat("%02i/%02i/%i" TimeDay(d), TimeMonth(d), TimeYear(d) ); } string DMYY(datetime d){ // 1/1/15 return Stringformat("%i/%i/%02i" TimeDay(d), TimeMonth(d), TimeYear(d) % 100 ); } : string c = StringFormat("From %s to %s", DDMMYYYY(start_date), DDMMYYYY(end_date));
Thanks got it!
Hi,
Please help me with a script that will convert the following MT4 date to regular date i.e. day/month/year
many thanks