Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

<?php
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

share|improve this question
add comment

1 Answer

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!

share|improve this answer
    
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 '13 at 2:11
    
@fran : no, the right answer is not to hack a core file. –  s_ha_dum Jul 20 '13 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 '13 at 4:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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