Hey guys I have an interesting date issue.
I'm trying to store birthdays. The MYSQL column is set as INT(10) and the name of the column is
bday.
I have 3 dropdowns: month, day, year.
I check that all the info is correct before I convert the data into timestamp for the database table.
PHP Code:
$bday = mktime(0, 0, 0, $u_month, $u_day, $u_year);
$bday is now in timestamp format.
So if my bday is: June 10 1990 it goes in as: 6, 10, 1990 respectively.
When I log off my site and come back, it seems to pull the data out with one day off, but the rest of the data is correct.
So I would get: 6 9 1990.
Here's the code when I pull it out of the DB:
PHP Code:
// MYSQL QUERY SNIPPET
$g_bday = $row["bday"];
$g_month = date("n",$g_bday);
$g_day = date("j",$g_bday);
$g_year = date("Y",$g_bday);
This gives me again: 6 9 1990
It is just sooo very weird that the day is always one off.
But everything else, MONTH or YEAR goes in and out perfectly.
If I change the day to 25, then I get back 24...
Do you guys have any idea why it does this?
I kept the code pretty short because I think most of you could figure out what I'm doing, and I don't beleive there's much more that I really need to show you but if you need any more code, let me know...