problem with date function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jorge Reyes

    #1

    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.
  • =?iso-8859-1?Q?=C1lvaro?= G. Vicario

    #2
    Re: problem with date function

    *** Jorge Reyes escribió/wrote (Tue, 18 Mar 2008 12:14:54 -0700 (PDT)):
    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('displa y_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
    --

    Comment

    • Rik Wasmus

      #3
      Re: problem with date function

      On Tue, 18 Mar 2008 20:14:54 +0100, Jorge Reyes <jorg_reyes@hot mail.com>
      wrote:
      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

      Comment

      • Jorge Reyes

        #4
        Re: problem with date function

        On 18 mar, 13:44, "Álvaro G. Vicario"
        <webmasterNOSPA MTHA...@demogra cia.comwrote:
        *** Jorge Reyes escribió/wrote (Tue, 18 Mar 2008 12:14:54 -0700 (PDT)):
        >
        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('displa y_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

        Comment

        • Jorge Reyes

          #5
          Re: problem with date function

          On 18 mar, 15:43, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
          On Tue, 18 Mar 2008 20:14:54 +0100, Jorge Reyes <jorg_re...@hot mail.com 
          wrote:
          >
          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?

          Comment

          • Toby A Inkster

            #6
            Re: problem with date function

            Jorge Reyes wrote:
            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

            Comment

            • Captain Paralytic

              #7
              Re: problem with date function

              On 18 Mar, 19:14, Jorge Reyes <jorg_re...@hot mail.comwrote:
              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?

              Comment

              • =?iso-8859-1?Q?=C1lvaro?= G. Vicario

                #8
                Re: problem with date function

                *** Jorge Reyes escribió/wrote (Tue, 18 Mar 2008 15:14:11 -0700 (PDT)):
                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://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
                --

                Comment

                Working...