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')
尝试将此函数date_default_timezone_set("Asia/Bangkok")
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.