Datetime comparison

Back to topics list To post a new topic, please log in or register
avatar
21
stradz 2009.10.08 18:47
 

How can I to a datetime comparison?


In my code, I use one datetime variable, lets say:

datetime forbiddenDate;


And some time during my strategy I give to this variable a value

forbiddenDate = Time[0];


Then I want to check date to see is it good time to open


if(forbiddenDate != Time[0]){

//open

}


But it seems it doesn't work?


Can anybody help me?

 
avatar
2568
Roger 2009.10.08 19:39 #
 

static datetime forbiddenDate;

if(forbiddenDate != Time[0]){
forbiddenDate = Time[0];

.........

}

avatar
26
winters 2015.05.24 15:09 #
 

I have a same problem ...

output for iTime: 915408000

But  for

datetime d1=1214870461; //D'2008.07.01 00:01:01';

Output is 1214870461, which is grater than a current date. In both cases it suppose to return unix timestamp, but it is not ...

 

 

avatar
12983
WHRoeder 2015.05.25 18:01 #
 
winters: it suppose to return unix timestamp, but it is not ...
It certainly is.

Mon, 04 Jan 1999 00:00:00 GMT = 915408000

Now D'2015.05.25' == 1432512000 which is greater than d1.

Back to topics list  

To add comments, please log in or register