Reputation: 155
Hey I am having trouble with dates currently. I have a simple table like this.
CREATE TABLE IF NOT EXISTS `pages` (
`page_id` int(11) NOT NULL AUTO_INCREMENT,
`day_of_birth` date NOT NULL,
PRIMARY KEY (`page_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
I insert string to the database (YYYY-MM-DD)
'1980-06-05'
and I echo the date like this:
echo date('d.m.Y',strtotime($page_info['day_of_birth']));
My problem is every day date record goes 1 day earlier. For instance, I save this date '1980-06-05'. next day I will see '1980-06-04' in my database and the day after that it will be '1980-06-03'. I think the type of the column cause that. What do you think? How can I fix this problem? is my echoing code correct?
Upvotes: 0
Views: 730
Reputation: 155
I was using this code from github https://github.com/abecoffman and I noticed that it has really specific problem with google chrome. You can see the issue here: https://github.com/abecoffman/birthdaypicker/issues/20 and here: https://github.com/abecoffman/birthdaypicker/pull/8 well it still does not work for me but I will try to fix it later. This question is not a database question anymore. Thank you for your answers.
Upvotes: 1