Download MetaTrader 5
To add comments, please log in or register
Deposit to your account via PayPal
yhoyo
48
yhoyo 2014.09.09 23:40 

hi everyone

 

do you know some way to convert a date '09.09.2014 18:32:47'  or the current time and date to Epoch???

 

thanks for help

 

yhoyo 

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.09.10 00:15  

Never try

TimeLocal()

?

yhoyo
48
yhoyo 2014.09.10 11:22  
deysmacro:

Never try

?


HI

 

No really.. that show the local time  (pc time).... but not the Espoch time :(

Alain Verleyen
Moderator
28564
Alain Verleyen 2014.09.10 11:23  
YHOYO:

hi everyone

 

do you know some way to convert a date '09.09.2014 18:32:47'  or the current time and date to Epoch???

 

thanks for help

 

yhoyo 

 

 

A datetime is Epoch.
yhoyo
48
yhoyo 2014.09.10 14:45  
angevoyageur:
A datetime is Epoch.


but  for example I do this:  Print("year: ", 2014*31556926);

 

the result is :  year: -868860476

and a error integral constant overflow

 

obviously the result should be year:  63555648964   

 

some ideas?? 

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.09.10 15:10  
https://docs.mql4.com/dateandtime
yhoyo
48
yhoyo 2014.09.10 15:19  
deysmacro:
https://docs.mql4.com/dateandtime


hi.. thanks for this.... the clue is the #property strict

 

 datetime date=D'2014.03.05 15:46:58';
  string str="mydate="+date;
//--- str="mydate=1394034418" - without #property strict

//--- str="mydate=2014.03.05 15:46:58" - with #property strict 

 

 thanks again

Alain Verleyen
Moderator
28564
Alain Verleyen 2014.09.10 15:42  

With property strict.

#property strict
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
void start()
  {
   datetime date=D'2014.03.05 15:46:58';
   string str="mydate="+StringFormat("%i",date);
   Print(str);
  }
/
To add comments, please log in or register