Email
Share

We Rock Your Web Forum » Content Management Systems » Drupal

Adjust time() to local timezone?

(2 posts)
  1. DrupalJunkie

    senior member
    Joined: Oct '09
    Posts: 77

    I'm running the Drupal countdown module, and have my local timezone (in Drupal's date/ time settings) set to "America/ New York" (EST or EDT). However, the countdown module is off by 4 hours, so I'm guessing it must be using the server time?

    Is there anyway to adjust the time() variable in the countdown module to reflect my local time and not the server time? I'm seeing that it appears to be calling the server time instead of the time I have set on my Drupal site.

    Posted 1 year ago #

  2. Posted 1 year ago
  3. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    Until this gets resolved by the module's author, you can add the following timezone offset (adjust the $offset variable based on your timezone vs. UTC; this particular example uses "-4" to adjust from UTC to EST ("America/ New York") timezone) to countdown.module (the line # will vary depending on which Drupal version you're using):

    function theme_countdown_block() {
      $time = time();
      $offset = -4;
      $time = $time + ($offset * 60 * 60);
    ...
    Posted 1 year ago #

RSS feed for this topic

Reply

(required)

Allowed markup: BBcode blockquote code em strong ul ol li font strike center u hr.
You can also put code in between backtick ( ` ) characters.