PHP returns an early date

-1

Good evening, I'm from Peru. I have a problem with the date that returns PHP that apparently is advanced. We are Saturday September 9 and I return Sunday (sun) September 10 .. I guess that's why the time zone and the language is from the USA how can I solve it?

date( 'D M Y')

Thank you.

    
asked by cassandra 10.09.2017 в 03:17
source

1 answer

2

I solved it using the following code

date_default_timezone_set ('UTC');

date_default_timezone_set ("America / Mexico_City");

I hope it works for you

    
answered by 10.09.2017 в 03:21