Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Quad, VoroneTZ, 1 invisible), 623 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
compare TIMESTAMP #482406
02/02/21 09:00
02/02/21 09:00
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
FAQ: compare the time in format WDATE ... don't use!
Is better to know... laugh

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


Last edited by Grat; 02/02/21 09:02.
Re: compare TIMESTAMP [Re: Grat] #482418
02/03/21 16:26
02/03/21 16:26
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Programmers never compare two vars with ==. Comparing them with > or < is ok.

https://manual.zorro-project.com/comparisions.htm

Re: compare TIMESTAMP [Re: Grat] #482454
02/08/21 15:08
02/08/21 15:08
Joined: Oct 2019
Posts: 27
Germany
TedMar Offline
Newbie
TedMar  Offline
Newbie

Joined: Oct 2019
Posts: 27
Germany
if u use DATE as windows format , campare it as INT like me laugh

Code
  
ymd(wdate(0)) == 20210215






Last edited by TedMar; 02/08/21 15:13.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1