Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (rki, AndrewAMD), 407 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 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,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
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