Skip to content
Advertisement

gmdate 12 hours off

I’m trying to get the GMT to send with an API request however my time is off from the actual GMT.

Right now the GMT is 6:40 PM Friday, November 20, 2020.

However when I run

gmdate("Y-m-dTh:i:sZ");

I get 2020-11-20T06:47:07Z. Which is 6AM instead of PM.

How do I get the correct GMT?

Advertisement

Answer

Change h to H to get a 24 hour hour. The small h gives you the hour in 12 hour format.

gmdate("Y-m-dTH:i:sZ");
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement