Welcome Guest, Not a member yet? Register   Sign In
mdate returning 12/31/1969 in date_helper.php
#1

[eluser]johnnyForums[/eluser]
I am trying to use the date_helper as per the documentation. I have this date:

1999-10-20 00:00:00

from my mysql database.

I tried in my view: <?php echo 'the dob :' . mdate('%m' . '/' . '%d' . '/' . '%Y', $row->DOB);?>

but I get back:

12/31/1969

However, if I change date_helper.php to have:

$date = date($datestr,strtotime($time)); //added this line
return $date; //date($datestr, $time); //line 95 now; broken returns 12/31/1969 each time;

I get the right thing back.

What is special about 12/31/1969 php and mysql? I have seen a lot of threads about mysql from lots of different apps and the 1969 date. What if the person's dob is 12/31/1969?

Is this a bug? Also, how can I get something more graceful if the date is empty instead of 12/31/1969? I can put in an if endif in my view but I'm starting to mix a little too much code into my view. Are there any ramifications to putting the strtotime there in date_helper.php?

Also, curious. How would I view the SQL that was really used here?

Thank you.


Messages In This Thread
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 03:00 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 03:26 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 03:30 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 03:37 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 04:03 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 05:02 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 09:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB