Help: Date function not returning correct date & time

This is a discussion on Help: Date function not returning correct date & time within the PHP Language forums, part of the PHP Programming Forums category; I have just notices that the date() function is not returning the correct date/time on my "server". ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-28-2005
Funnyweb
 
Posts: n/a
Default Help: Date function not returning correct date & time

I have just notices that the date() function is not returning the correct
date/time on my "server".

I am running apache2 on my winxp pro laptop.

My system clock is set to the correct date, time and timezone, get the
results returned by date() are 11 hours behind.

Any ideas what is going wrong?

Thanks


Reply With Quote
  #2 (permalink)  
Old 05-28-2005
Ken Robinson
 
Posts: n/a
Default Re: Help: Date function not returning correct date & time



Funnyweb wrote:
> I have just notices that the date() function is not returning the correct
> date/time on my "server".
>
> I am running apache2 on my winxp pro laptop.
>
> My system clock is set to the correct date, time and timezone, get the
> results returned by date() are 11 hours behind.


Without seeing a sample of you're code, it is impossible to say what
might be wrong.

Ken

Reply With Quote
  #3 (permalink)  
Old 05-28-2005
Funnyweb
 
Posts: n/a
Default Re: Help: Date function not returning correct date & time


"Ken Robinson" <kenrbnsn@rbnsn.com> wrote in message
news:1117247592.731272.70640@g43g2000cwa.googlegro ups.com...
>
>
> Funnyweb wrote:
>> I have just notices that the date() function is not returning the correct
>> date/time on my "server".
>>
>> I am running apache2 on my winxp pro laptop.
>>
>> My system clock is set to the correct date, time and timezone, get the
>> results returned by date() are 11 hours behind.

>
> Without seeing a sample of you're code, it is impossible to say what
> might be wrong.
>
> Ken
>



There is nothing special about my code. All I do is call the date function.
For example:

$today = date("j M Y - H:i:s");

The result of this call is 11 hours behind my local time. I am in New
Zealand and the time being returned is what it would currently be in the UK.

Any ideas?



Reply With Quote
  #4 (permalink)  
Old 05-29-2005
mX
 
Posts: n/a
Default Re: Help: Date function not returning correct date & time

Yes, date() returns GMT date by default, I think.

UK and Portugal (where I live) are placed on the GMT line, that's why
you are getting that.

There is a function on php, which returns de date of the server... I'll
try to look for it.

Reply With Quote
  #5 (permalink)  
Old 05-29-2005
Chris Hope
 
Posts: n/a
Default Re: Help: Date function not returning correct date & time

mX wrote:

> Yes, date() returns GMT date by default, I think.
>
> UK and Portugal (where I live) are placed on the GMT line, that's why
> you are getting that.
>
> There is a function on php, which returns de date of the server...
> I'll try to look for it.


gmdate() does it in GMT. date() does it in the local time of the server.

From the manual http://www.php.net/date
"Returns a string formatted according to the given format string using
the given integer timestamp or the current local time if no timestamp
is given."

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:46 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0