Posted By: Grat
compare TIMESTAMP - 02/02/21 09:00
FAQ: compare the time in format WDATE ... don't use!
Is better to know...
output is:
Is better to know...
Code
//Wed 20-04-01 16:00 == unixtime 1585756800 string GetTest(){ return strf("%04d-%02d-%02d %02d:%02d", 2020,04,01,16,0); } // --------------------------- Main----------------------------- function main() { string cTest; cTest = GetTest(); var dwDate=wdatef("%Y-%m-%d %H:%M", cTest); printf("\ndwDate = %f",dwDate); cTest = strf("%d",utm(dwDate)); printf("\n%s",cTest); var duDate=wdatef("%t",cTest); printf("\ndw: %f du: %f",dwDate,duDate); printf("\nW: %d U: %d",utm(dwDate),utm(duDate)); if (duDate == dwDate) printf("\nwdate is OK"); if( utm(duDate) == utm(dwDate)) printf("\nCompare with convert to UnixTime is OK"); }
output is:
Code
test compiling............... ok dwDate = 43922.666667 1585756800 dw: 43922.666667 du: 43922.666667 W: 1585756800 U: 1585756800 Compare with convert to UnixTime is OK