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']; 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); 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. 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 Link to comment https://forums.phpfreaks.com/topic/66053-help-with-dob/#findComment-330416 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.