crypted Posted October 24, 2006 Share Posted October 24, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/ Share on other sites More sharing options...
bob_the _builder Posted October 24, 2006 Share Posted October 24, 2006 Hi,Prolly not the answer you after .. But I alter the date in my query when I call it from the database to display on the page:[code=php:0]DATE_FORMAT(ADDDATE(date, INTERVAL 3 HOUR), '%d %b %Y %r') AS date[/code]hth Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/#findComment-113499 Share on other sites More sharing options...
heckenschutze Posted October 24, 2006 Share Posted October 24, 2006 If your using a unix timestamp,[code]<?php//** from php manual, not mine. Since we made need negative basesfunction 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. Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/#findComment-113502 Share on other sites More sharing options...
crypted Posted October 24, 2006 Author Share Posted October 24, 2006 I'm using <?php echo mosCurrentDate(); ?> to display the time, and I believe it's basically using the FreeBSD servers time to call and echo through php onto the website. Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/#findComment-113503 Share on other sites More sharing options...
heckenschutze Posted October 24, 2006 Share Posted October 24, 2006 . Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/#findComment-113506 Share on other sites More sharing options...
Zane Posted October 24, 2006 Share Posted October 24, 2006 echo strtotime("-1 hour", strtotime(mosCurrentDate())); Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/#findComment-113507 Share on other sites More sharing options...
crypted Posted October 24, 2006 Author Share Posted October 24, 2006 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> Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/#findComment-113695 Share on other sites More sharing options...
Zane Posted October 24, 2006 Share Posted October 24, 2006 what's the way the date should correctly show.take a look at the date funciton here http://www.php.net/dateand use this whole statement as the second argumentfor instance[code=php:0]date("Y-m-d:h:m:s", strtotime("-1 hour", strtotime(mosCurrentDate())));[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/#findComment-113817 Share on other sites More sharing options...
crypted Posted October 24, 2006 Author Share Posted October 24, 2006 I follow what you're saying, but when I implement that string, it outputs the correct date, 2006-10-24, but the time gets output as 01:10:00 when the system time is 4:42PM and the CST time is 3:42PM... Quote Link to comment https://forums.phpfreaks.com/topic/24901-how-to-use-currentdate-function-but-deduct-an-hour/#findComment-113838 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.