I want to get current date in php but it is displaying one day advance.
I am surprised why this is happening as I am using very simple code:
date('Y-m-d')
I want to get current date in php but it is displaying one day advance.
I am surprised why this is happening as I am using very simple code:
date('Y-m-d')
Please set date time zone as IST. Then try. May your server config time zone is USA. So please add below lines in your code and check it
date_default_timezone_set('Asia/Kolkata');
echo date('d-m-Y');
For more about PHP date time please visit here