PDA

View Full Version : Explain PHP dates



UrbanTwitch
09-12-2008, 12:36 AM
I am not good with PHP Dates. Can someone put this in english:


$check = mysql_fetch_array($checkflood);
$time = date("YmdHis");
$ftime = date("YmdHis", time() + 10);

This is a anti-spam flood thingy. Does the +10 mean you have to wait 10 seconds before you can post again? (on a comment board)

mic2100
09-12-2008, 01:16 PM
here are the basics of the date and time functions i suggest going to www.php.net to read in more detail,


time(); //return a unix timestamp (number of secs since 1/1/1970)
time() + 10; //would give u a unix timestamp 10secs in the future

date("YmdHis", time() + 10); //gives you a formated date that is 10 secs in the future

UrbanTwitch
09-12-2008, 04:08 PM
Well the +10 is not 10 seconds for me. I have to wait longer.

mic2100
09-12-2008, 04:47 PM
i wud recommend checking out

http://uk2.php.net/manual/en/function.time.php
and...
http://uk2.php.net/manual/en/function.date.php

according to the manual the time() function is as i said the number of seconds and if + 10 u shud get a time 10s in the future.

if you post your code we could maybe see if anything else if affecting it?