For my surprise today i see wordpress put bad the hour

In settings i have the hour of my country , France and City Paris

And today i try for create one function the php date function for show the date

echo date("dmY");

For my surprise as i tell until , see wordpress change my php time and put day 19 and change the hour and no show the real time actually

If the same code insert in other site - no use wordpress - and the date show right , day 20

How it´s possible wordpress change native function of php and show when runnning this thedate of php , by other side in settings of wordpress i se utc different hour to local time , utc show 19 and local time show 20

I don´t understan all this .....

Thank´s for the help

1 Answer 1


Did you go to Settings >> General and set the correct offset for your timezone?

To get the date:
<?php $date = get_the_time('dmY', $post->ID); ?>

To print the date:
<?php the_date('dmY'); ?>

Both need to be within the Loop!

  • the problem it´s with setting of wordpress and need change the line 36 for show right the date() core funtion of php : //date_default_timezone_set( 'UTC' ); if ( !function_exists( 'date_default_timezone_set' ) ) date_default_timezone_set( 'UTC' );
    – Fran
    Jul 20, 2013 at 2:11
  • @fran : no, the right answer is not to hack a core file.
    – s_ha_dum
    Jul 20, 2013 at 4:45
  • I think that no hack the code , those words no agree for me , only access to the wp-settings no touch all core and if you know the core you know this right , wordpress it´s very good but in this case for me yes it´s necessary change this line of code because i have one script writte by me and i can´t change all script for one line and because wordpress no let some as the core of php works fine
    – Fran
    Jul 20, 2013 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.