Jump to content

add current time with date in timestamp?


tanveer

Recommended Posts

you could use strtotime() on their input but not reliably. Rather than have the user type a date in, Id recommend giving the user three select boxes for day, month and year respectively. That will give you a lot more control over the input. Then to make a timestamp you could use for example

//you should validate that the date they've posted is valid, e.g not 30 february, though mktime will work that out as 1 march i think
$db_timestamp = mktime(12,0,0,$_POST['month'],$_POST['day'],$_POST['year']); //assuming of course those posted values are integers. 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.