tibberous Posted August 12, 2008 Share Posted August 12, 2008 Is this right? $data['birthDate'] = $birthDate ? date("Y-m-d", $birthDate) : ''; To store in a mysql database, where $birthDate is a timestamp? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 12, 2008 Share Posted August 12, 2008 I think your ternary operator is a bit confused. There's no condition being evaluated. Unless you meant to compare $data['birthDate'] to $birthDate? In which case, that assignment operator (=) needs to be an equality comparison operator (==), and you need to be assigning the value to a variable (or echoing it, etc). But yes, if your field is a date field, the format is YYYY-MM-DD, so will be generated by date('Y-m-d'). Quote Link to comment Share on other sites More sharing options...
tibberous Posted August 15, 2008 Author Share Posted August 15, 2008 Yes their is, it's (boolean)$birthDate. I'm using to see if they put in a birthdate, and leaving it blank if they haven't. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.