Datetime comparison

To add comments, please log in or register
Strahinja Krstic
48
Strahinja Krstic  

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?

Alexander
2441
Alexander  

static datetime forbiddenDate;

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

.........

}

winterss
359
winterss  

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 ...

William Roeder
20207
William Roeder  
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.

Kola
56
Kola  
Alexander:

static datetime forbiddenDate;

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

.........

}

I know some of the guru's will eat me because the thread is old but I've tried to compare ....

datetime prtclrPrev_Bar[];
.....

iTime(vklDvoiki[valu],vrTF,0)!=prtclrPrev_Bar[TF]

and values were the same but condition continued to fulfill as they are different...

Only after I made....

static datetime prtclrPrev_Bar[];

condition stopped to fulfill.

So thanx Alexander after more than 10 years.

To add comments, please log in or register