I have a php script inserting values in to SQL Server 2005 table via SQL
$date = '15 Jun 2011 00:00';
$sql = "INSERT INTO shows ( DateStart ) VALUES ( '$date')";
I have 2 issues:
1) how best to convert this date into something SQL Server understands? The default format is mm/dd/yyyy on my system but I want to present the dates as readable to the user.
2) When inserting an empty string the DateStart value gets set to 1/1/1900. How best to convert an "invalid" date into a NULL (the column already accepts NULLs) so that if $date = ""
then DateStart IS NULL
Thanks!