I am facing an issue in strtotime() in wordpress, that it is subtracting the hours according to my configured local timezone.
For example i tried strtotime("2021-11-16 00:00:00")
on online php compiler it shows…
1637020800
but when i run the same on my wordpress site, var_dump(strtotime("2021-11-16 00:00:00"));
it shows:
1637002800
which is wrong it is subtracting 5 hours as i set GMT+5 in my general settings.
I tried current_time(‘timestamp’) but it won’t help
Please can anyone help?
2
Answers
i found the problem in wordpress version 5.4.2, so basically in time zone if you select city,country it shows you this problem. While if you select like GMT +5 etc it will show correct.
So i change Karachi to GMT+5 which make it sorted.
Use this: