get_the_date() return always UTC+0 [duplicate]

date_default_timezone_set can alter the output of a new DateTime. Not sure how it will affect get_the_time. $date = new DateTime( get_the_time(‘c’) ); $date->setTimezone(new DateTimeZone(‘Europe/Warsaw’)); echo $date->format(‘c’); $date = new DateTime(); echo $date->format(‘c’); // 2015-12-18T18:21:31+00:00 $date->setTimezone(new DateTimeZone(‘Europe/Warsaw’)); echo $date->format(‘c’); // 2015-12-18T19:21:31+01:00 date_default_timezone_set(‘Europe/Warsaw’); $date = new DateTime(); echo $date->format(‘c’); // 2015-12-18T19:21:31+01:00

How to get the date of all blog posts

If you want to get the dates of all blog posts then you’ll need to perform your own query and loop that. This is the query: <? $posts = new WP_Query(array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1 )); ?> Now you’ll need to loop those posts like so: <? if( $posts->have_posts() ) : while( $posts->have_posts() … Read more

wp_date doesn’t work

I was able to make my local WP installation display the date in French: switch_to_locale( ‘fr_CA’ ); echo wp_date( ‘F d’ ); Output: octobre 11 (Note that I didn’t have to localize my date format string (ie, no __() inside the wp_date() call.) However, when I tried Dutch: switch_to_locale( ‘nl_NL’ ); echo wp_date( ‘F d’ … Read more

Get system timestamp in wordpress

You can use PHP’s date() function here, but usually first you’ll need to run date_default_timezone_set. UTC+1 looks like Central Europe time from what I can tell, so here’s what I’d run: <?php date_default_timezone_set(‘Europe/Berlin’); echo date( ‘D, d M Y H:i:s’, now() ); ?> That will print out the current time from your server. If you’re … Read more

error code: 523