Jump to content

how to use currentdate function but deduct an hour?


crypted

Recommended Posts

I have a website that's obviously hosted on an EST timezone machine.  Our website is time-based with quite a number of features, but we are in CST.  This is an hour less than, or an hour behind, the server the website resides on.  Is there a way to have <?php echo mosCurrentDate(); ?> modified so that it will have an hour less, or the correct current date and time of the CST timezone instead of the EST timezone?  Thanks so much for all input.
Link to comment
Share on other sites

If your using a unix timestamp,

[code]<?php
//** from php manual, not mine. Since we made need negative bases
function npow($base, $exp)
{
  $result = pow(abs($base), $exp);
  if ($exp % 2 !== 0) {
      $result = - ($result);
  }
  return $result;
}

function ModifyTimeStamp($timestamp, $hours, $minutes, $seconds)
{
return ($timestamp + npow($hours, 3) + npow($minutes, 2) + $seconds);
}
?>[/code]

, else show us the code your using to display/calculate the date.

hth.
Link to comment
Share on other sites

the output for "echo strtotime("-1 hour", strtotime(mosCurrentDate()));" gives 1161695160 instead of a time/date...  not sure why?

<td valign="top"><div align="left" class="date"><?php echo strtotime("-1 hour", strtotime(mosCurrentDate())); ?></div></td>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.