I used to get today’s record from MySQL database. I used this code:
$whr_follow = "(DATE(R.reg_time) = Date(NOW()) )" ;
$this->db->where($whr_follow);
Today is march 1st, but I get yesterdays. In local server it works fine.
I tried select now()
query in phpmyadmin.
In live server it resulted 2019-02-28 23:30:36
but in local server its 2019-03-01 10:59:14
I tried to change phpmyadmin timezone win phpmyadmin running set timezone=timezone
(asia/kolkatha) but makes no changes.Any idea?
4
Answers
change the time zone on your live server, because your live server is late, not your local server.
hope this helps!
First, make sure both local and live server have the same time zone.
Second, make sure your input and the date format in the DB should be same
Make other date format same as well
first get current date.i hope it will help you.
=>You get Current Date and then change your date Formate
"Y-m-d"
same as a database date format.