Hello,
I've DOB field in my database with date datatype.
Bt when I enter 1 March 1980 from front end it stores 29 Feb 1980 in database.
Can anyone help me?
Thanx a lot in advance.
Problem Regarding Leap Year
This is because the code that calculates date
is not really correct.
The only way to help you, is if you post that actual php code
that handles that time and date thing you refer to.
$con = mysql_connect("localhost","",""); / Establishing connection with server/
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("abc", $con); /* Establishing connection with data base*/
$date=mysql_real_escape_string($_POST['date']);
$month=mysql_real_escape_string($_POST['month']);
$year=mysql_real_escape_string($_POST['year']);
$send_on=date("Y-m-d");
$dob= date("Y-m-d",strtotime("$year-$month-$date"));
$sql = "INSERT INTO Applicant (dob)
VALUES ('$dob')";
This is my code and Datatype for dob in mysql is DATE Plz help me if you can
a month later
Switch to a db that does date math correctly? Seriosuly, mysql's date math has been and continues to be pretty cruddy. Also check for a bug fix in the mysql code base, it could be as easy as updating your db to fix this one bug.