Dynadot โ€” .com Transfer

Help (mktime)

Spaceship Spaceship
Watch

Barrucadu

Established Member
Impact
64
PHP:
$timeout = 15;
$t_stamp = mktime(date('H'),date('i')-$timeout,date('s'));
die($t_stamp);

That should return the time (in mysql format) 15 minutes ago, but it dosnt. It dosnt return anything.

Whats wrong?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
echo $t_stamp;
die();

why?
die() does not print integers
die("$t_stamp");
works too
 
0
•••
It dosnt print integers?

*feels stupid now*

lol

--edit--

Now I have a different problem:

PHP:
	function Update_Stats($timeout,$stats){
		$t_stamp = mktime(date('H'),date('i')-$timeout,date('s'),0,0,0);
		
		$this->Database_Query('delete from ' .$stats . ' where visited < '.$t_stamp);
	}

the field visited is a mysql time.
It should delete all entries where visited is more than 15 mins ago, but it deletes everything.
 
Last edited:
0
•••
i'm not sure why, but you can use int for timestamps
 
0
•••
PHP timestamps and MySQL datetimes are not the same thing... it all depends on your column types.

There is a MySQL function called something like UNIXTIMESTAMP that will return a MySQL date as a timestamp and I know there's one for converting from UNIX to MySQL, but I don't know it off the top of my head. However, do some digging for UNIXTIMESTAMP and you're bound to find the 'reverse' function name.
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Appraise.net
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back