Connecting Tech Pros Worldwide Help | Site Map

problem with date function

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 18th, 2008, 07:15 PM
Jorge Reyes
Guest
 
Posts: n/a
Default problem with date function

Hi everyone i have this problem, when i use date('Y-m-d H:i:s') its
returning 1 more hour than it is, i mean if now is 2008-03-18
13:16:00:00 my function returns 2008-03-18 13:17:00:00, so the
question is why?. I check this on the php.ini and i don´t found
anything related and of course my server time is ok i check it, thanks
for your help.

  #2  
Old March 18th, 2008, 07:45 PM
=?iso-8859-1?Q?=C1lvaro?= G. Vicario
Guest
 
Posts: n/a
Default Re: problem with date function

*** Jorge Reyes escribió/wrote (Tue, 18 Mar 2008 12:14:54 -0700 (PDT)):
Quote:
Hi everyone i have this problem, when i use date('Y-m-d H:i:s') its
returning 1 more hour than it is, i mean if now is 2008-03-18
13:16:00:00 my function returns 2008-03-18 13:17:00:00, so the
question is why?. I check this on the php.ini and i don´t found
anything related and of course my server time is ok i check it, thanks
for your help.
What's your date.timezone directive like? Do you get any notice if you run
the command this way?:

<?php

ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
echo date('Y-m-d H:i:s');

?>



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
  #3  
Old March 18th, 2008, 09:45 PM
Rik Wasmus
Guest
 
Posts: n/a
Default Re: problem with date function

On Tue, 18 Mar 2008 20:14:54 +0100, Jorge Reyes <jorg_reyes@hotmail.com>
wrote:
Quote:
Hi everyone i have this problem, when i use date('Y-m-d H:i:s') its
returning 1 more hour than it is, i mean if now is 2008-03-18
13:16:00:00 my function returns 2008-03-18 13:17:00:00, so the
question is why?. I check this on the php.ini and i don´t found
anything related and of course my server time is ok i check it, thanks
for your help.
Y -m -d H :i :s
2008-03-18 13:17:00:00

Where does the extra ':00' come from? Is this a typing error, or is your
clock just 1 minute off?
--
Rik Wasmus
  #4  
Old March 18th, 2008, 10:15 PM
Jorge Reyes
Guest
 
Posts: n/a
Default Re: problem with date function

On 18 mar, 13:44, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
Quote:
*** Jorge Reyes escribió/wrote (Tue, 18 Mar 2008 12:14:54 -0700 (PDT)):
>
Quote:
Hi everyone i have this problem, when i use date('Y-m-d H:i:s') its
returning 1 more hour than it is, i mean if now is 2008-03-18
13:16:00:00 my function returns *2008-03-18 13:17:00:00, so the
question is why?. I check this on the php.ini and i don´t found
anything related and of course my server time is ok i check it, thanks
for your help.
>
What's your date.timezone directive like? Do you get any notice if you run
the command this way?:
>
<?php
>
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
echo date('Y-m-d H:i:s');
>
?>
>
--
--http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:http://bits.demogracia.com
-- Mi web de humor en cubitos:http://www.demogracia.com
--
the date.timezone directive is commented just as default is, now i put
your lines and nothing happens, its showing the same 1 more hour, i
had to change my sql query because i need the time so now i am using
the sysdate() of the oracle server but i still need to undertstand
what happening. Regards
  #5  
Old March 18th, 2008, 10:25 PM
Jorge Reyes
Guest
 
Posts: n/a
Default Re: problem with date function

On 18 mar, 15:43, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
Quote:
On Tue, 18 Mar 2008 20:14:54 +0100, Jorge Reyes <jorg_re...@hotmail.com*
wrote:
>
Quote:
Hi everyone i have this problem, when i use date('Y-m-d H:i:s') its
returning 1 more hour than it is, i mean if now is 2008-03-18
13:16:00:00 my function returns *2008-03-18 13:17:00:00, so the
question is why?. I check this on the php.ini and i don´t found
anything related and of course my server time is ok i check it, thanks
for your help.
>
Y * -m -d *H :i :s
2008-03-18 13:17:00:00
>
Where does the extra ':00' come from? Is this a typing error, or is your *
clock just 1 minute off?
--
Rik Wasmus
yes sorry this is a typing error. this is the thing 13:16:00 sorry!
any idea?
  #6  
Old March 19th, 2008, 11:05 AM
Toby A Inkster
Guest
 
Posts: n/a
Default Re: problem with date function

Jorge Reyes wrote:
Quote:
Hi everyone i have this problem, when i use date('Y-m-d H:i:s') its
returning 1 more hour than it is
Try: date('Y-m-d H:i:s O')

This will add the timezone to the date. Is the timezone what you'd expect?

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 1 day, 12:04.]

The Semantic Web
http://tobyinkster.co.uk/blog/2008/03/09/sw/
  #7  
Old March 19th, 2008, 11:15 AM
Captain Paralytic
Guest
 
Posts: n/a
Default Re: problem with date function

On 18 Mar, 19:14, Jorge Reyes <jorg_re...@hotmail.comwrote:
Quote:
Hi everyone i have this problem, when i use date('Y-m-d H:i:s') its
returning 1 more hour than it is, i mean if now is 2008-03-18
13:16:00:00 my function returns 2008-03-18 13:17:00:00, so the
question is why?. I check this on the php.ini and i don´t found
anything related and of course my server time is ok i check it, thanks
for your help.
As far as I can see it is 1 minute not 1 hour out?
  #8  
Old March 20th, 2008, 10:45 AM
=?iso-8859-1?Q?=C1lvaro?= G. Vicario
Guest
 
Posts: n/a
Default Re: problem with date function

*** Jorge Reyes escribió/wrote (Tue, 18 Mar 2008 15:14:11 -0700 (PDT)):
Quote:
the date.timezone directive is commented just as default is
Right... Then uncomment it and give it a proper value. Mine is
"Europe/Madrid", yours will be similar. Find the list of available time
zones here:

http://es2.php.net/manual/en/timezones.php



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.