I have a form that passes two dates (start and finish) to a PHP script that will add those to a DB. I am having problems validating this. I keep getting the following errors
A non well formed numeric value encountered
This is when I use the following
date("d",$_GET['start_date']);
But when I use the strtotime() function as advised by many sites I get a unix timestamp date of 1/1/1970. Any ideas how I can get the correct date?
Because you are passing a string as the second argument to the date function, which should be an integer.
string date ( string $format [, int $timestamp = time() ] )
Try strtotime which will Parse about any English textual datetime description into a Unix timestamp (integer):
date("d", strtotime($_GET['start_date']));