By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,403 Members | 1,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,403 IT Pros & Developers. It's quick & easy.

Help: Date function not returning correct date & time

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a


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

Jul 17 '05 #2

P: n/a

"Ken Robinson" <ke******@rbnsn.com> wrote in message
news:11*********************@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?

Jul 17 '05 #3

P: n/a
mX
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.

Jul 17 '05 #4

P: n/a
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
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.