Jump to content


Photo

Question about date() function


  • Please log in to reply
1 reply to this topic

#1 Corona4456

Corona4456
  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts
  • LocationEl Paso, TX

Posted 04 May 2006 - 06:44 AM

I searched around for an answer but I wasn't able to find one so if you can point me to a solution that would be great or if you can solve this problem then that would be great too. Ok, here is my problem. Well first thing is first here are the webserver specs:
Windows XP Professional w/ SP2
PHP 5.1.2
MySQL 5.0.18
Apache 2.0.55

Now on to the problem. I'm trying to use the date function. and when I do:
<?php
  echo date("Y-m-d H:i:s T I");
?>
I get an hour time difference from my server. My server is set to use DST but ever since the time change in April occured the PHP date function has been returning the time 1 hour behind. For example, when I run it I get:
2006-05-03 23:37:31 MST 0
When I expect:
2006-05-04 0:37:31 MDT 1

It's not a HUGE problem but something I would definitely like to get fixed (if possible). I've tried setting the time zone by editing the php.ini file but it didn't seem to do anything. So if anyone has a solution to this problem or if you need more info please let me know. Thanks in advance.
What is the CoronaMatrix?

#2 tjhilder

tjhilder
  • Members
  • PipPipPip
  • Advanced Member
  • 136 posts
  • LocationKent, UK

Posted 04 May 2006 - 02:27 PM

<?php
  echo date("Y-m-d H:i:s T I", time() + 60*60));
?>

60*60 = 1 hour

more further explanation can be found at php.net --> [a href=\"http://www.php.net/manual/en/function.time.php\" target=\"_blank\"]here[/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users