refiking Posted August 21, 2007 Share Posted August 21, 2007 On the prior form, I collected the month, date and year. How can I make it appear as mm-dd-yyyy? Here is the code: <?php session_start(); print $name; $day = $_POST['day']; $month = $_POST['month']; $year = $_POST['year']; $dob = $month $day, $year; $_SESSION['dob'] = $dob; print $_SESSION['dob']; Quote Link to comment https://forums.phpfreaks.com/topic/66053-help-with-dob/ Share on other sites More sharing options...
Barand Posted August 21, 2007 Share Posted August 21, 2007 $dob = sprintf('%02d-%02d-%d', $month, $day, $year); Quote Link to comment https://forums.phpfreaks.com/topic/66053-help-with-dob/#findComment-330401 Share on other sites More sharing options...
roopurt18 Posted August 21, 2007 Share Posted August 21, 2007 If you're storing this in a database, please use a DATETIME field. Quote Link to comment https://forums.phpfreaks.com/topic/66053-help-with-dob/#findComment-330414 Share on other sites More sharing options...
Barand Posted August 21, 2007 Share Posted August 21, 2007 ... or a DATE field if the time is irrelevant Quote Link to comment https://forums.phpfreaks.com/topic/66053-help-with-dob/#findComment-330416 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.