Connecting Tech Pros Worldwide Help | Site Map

problem with date function

  #1  
Old March 18th, 2008, 08:15 PM
Jorge Reyes
Guest
 
Posts: n/a
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, 08:45 PM
=?iso-8859-1?Q?=C1lvaro?= G. Vicario
Guest
 
Posts: n/a

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, 10:45 PM
Rik Wasmus
Guest
 
Posts: n/a

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, 11:15 PM
Jorge Reyes
Guest
 
Posts: n/a

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, 11:25 PM
Jorge Reyes
Guest
 
Posts: n/a

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, 12:05 PM
Toby A Inkster
Guest
 
Posts: n/a

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, 12:15 PM
Captain Paralytic
Guest
 
Posts: n/a

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, 11:45 AM
=?iso-8859-1?Q?=C1lvaro?= G. Vicario
Guest
 
Posts: n/a

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
--
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with date Mark answers 6 August 2nd, 2007 03:45 PM
Problem with Date in Email Header Ramon answers 7 August 19th, 2006 04:15 PM
Problem with date calculation in form Pete answers 6 July 20th, 2005 02:10 PM