06.01.2010, 17:32
Hey,
I'm trying yo check time difference between 2 dates..
Here's my unsuccessfull go:
* - I tried printing stuff that is on the last line of this code.. Here's what it printed:
Why DateINT and DateINT2 isn't same as FullDate and FullDate2 ??
Maybe you know any better ways to check difference between two dates?
What I want to do is to check if one day has passed before player was at specified location...
Thanks for HUGE help..
I'm trying yo check time difference between 2 dates..
Here's my unsuccessfull go:
pawn Code:
new y,m,d,h,i;
new y2,m2,d2,h2,i2;
new FullDate[12],FullDate2[12],DATE2[12],TIME2[8]; // FullDate(2) - "YYYYMMDDHHII" ; DATE2 - "YYYY-MM-DD"; TIME2 - "HH:II";
new DateINT,DateINT2; // DateINT(2) - strval(FullDate(2))
getdate(y,m,d);
gettime(h,i);
format(FullDate,12,"%d%02d%02d%02i%02i",y,m,d,h,i); // This will be date without any other symbols (not YYYY-MM-DD, HH:II , but YYYYMMDDHHII)
DateINT = strval(FullDate); // Should return FullDate in integer*..
sscanf("2010-01-01, 12:00","p,ss",DATE2,TIME2); // Splits 2010-01-01, 12:00 >> to 2010-01-01 and 12:00
sscanf(DATE2,"p-ddd",y2,m2,d2); // Splits 2010-01-01 to 2010 01 01
sscanf(TIME2,"p:dd",h2,i2); // Splits 12:00 to 12 00
format(FullDate2,12,"%d%02d%02d%02i%02i",y2,m2,d2,h2,i2); // YYYYMMDDHHII - this is date from file
DateINT2 = strval(FullDate2); // This SHOULD return FullDate2 in integer*..
printf("FullDate: %s , FullDate2: %s , DateINT: %d , DateINT2: %d",FullDate,FullDate2,DateINT,DateINT2); //DEBUG *
Quote:
[19:12:32] FullDate: 201001061912 , FullDate2: 201001061822 , DateINT: -862401000 , DateINT2: -862401090 |
Maybe you know any better ways to check difference between two dates?
What I want to do is to check if one day has passed before player was at specified location...
Thanks for HUGE help..
