0

Problem is that $today is pulling GMT from the database; I need to offset GMT by -6 hours; Have been unable to find a query with an offset like that.

<?php
   $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
   $today = date('Y-m-d');
   query_posts(array(
   'post_type' => 'performance', 
   'posts_per_page' => 4, 
   'caller_get_posts' => 4, 
   'paged' => $paged,
   'meta_key' => 'order-date',
   'orderby' => 'meta_value',
   'order' => 'ASC',
       'meta_query' => array(
           array(
             'key' => 'order-date',
             'meta-value' => $value,
             'value' => $today,
             'compare' => '>=',
             'type' => 'CHAR'
         )
      )
    ));
  if (have_posts()) :
  while (have_posts()) : the_post();
?>
1

Is WP set to that -6 offset you need? In that case try date_i18n() to generate your date instead of date().

| improve this answer | |
  • Yes, WP is set to local timezone. I resolved the problem by using the following: $today = date('Y-m-d', strtotime('-6 hours')); Will test your suggestion. – Ray Gulick Jul 25 '11 at 13:15
  • @Ray Gulick yes, custom offset would be my second suggestion, but if you simply need it in WP's time then date_i18n() is less to think about. – Rarst Jul 25 '11 at 14:13

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.