Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-397

PostgreSQL - getDateTimeTzFormatString()

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 2.3.1
    • Fix Version/s: None
    • Component/s: Platforms
    • Environment:
      PostgreSQL Database

      Description

      In:

      • vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php

      The function:

      getDateTimeTzFormatString()

      only returns one datetime format:

          /**
           * {@inheritDoc}
           */
          public function getDateTimeTzFormatString()
          {
              //return 'Y-m-d H:i:sO'; // original format
              return 'Y-m-d H:i:s.uO'; // format also needed
          }
      
      
      

      Here is the error I get using the original format:

      Could not convert database value "2012-12-07 16:01:52.580789-05" to Doctrine Type datetimetz. Expected format: Y-m-d H:i:s.O

      If I use this format: 'Y-m-d H:i:s.uO' it works.

        Activity

        ppafford Phill Pafford created issue -
        Hide
        ppafford Phill Pafford added a comment -

        adding html tags for code to display correctly

        Show
        ppafford Phill Pafford added a comment - adding html tags for code to display correctly
        ppafford Phill Pafford made changes -
        Field Original Value New Value
        Description In:

         - vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php

        The function:

            getDateTimeTzFormatString()

        only returns one datetime format:

            /**
             * {@inheritDoc}
             */
            public function getDateTimeTzFormatString()
            {
                //return 'Y-m-d H:i:sO'; // original format
                return 'Y-m-d H:i:s.uO'; // format also needed
            }

        Here is the error I get using the original format:

            Could not convert database value "2012-12-07 16:01:52.580789-05" to Doctrine Type datetimetz. Expected format: Y-m-d H:i:s.O

        If I use this format: 'Y-m-d H:i:s.uO' it works.




            
        In:

         - vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php

        The function:

            getDateTimeTzFormatString()

        only returns one datetime format:

        <pre><code>
            /**
             * {@inheritDoc}
             */
            public function getDateTimeTzFormatString()
            {
                //return 'Y-m-d H:i:sO'; // original format
                return 'Y-m-d H:i:s.uO'; // format also needed
            }

        </code></pre>

        Here is the error I get using the original format:

            Could not convert database value "2012-12-07 16:01:52.580789-05" to Doctrine Type datetimetz. Expected format: Y-m-d H:i:s.O

        If I use this format: 'Y-m-d H:i:s.uO' it works.




            
        fabio.bat.silva Fabio B. Silva made changes -
        Description In:

         - vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php

        The function:

            getDateTimeTzFormatString()

        only returns one datetime format:

        <pre><code>
            /**
             * {@inheritDoc}
             */
            public function getDateTimeTzFormatString()
            {
                //return 'Y-m-d H:i:sO'; // original format
                return 'Y-m-d H:i:s.uO'; // format also needed
            }

        </code></pre>

        Here is the error I get using the original format:

            Could not convert database value "2012-12-07 16:01:52.580789-05" to Doctrine Type datetimetz. Expected format: Y-m-d H:i:s.O

        If I use this format: 'Y-m-d H:i:s.uO' it works.




            
        In:

         - vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php

        The function:

            getDateTimeTzFormatString()

        only returns one datetime format:
        {code}
        <pre><code>
            /**
             * {@inheritDoc}
             */
            public function getDateTimeTzFormatString()
            {
                //return 'Y-m-d H:i:sO'; // original format
                return 'Y-m-d H:i:s.uO'; // format also needed
            }

        </code></pre>
        {code}

        Here is the error I get using the original format:

            Could not convert database value "2012-12-07 16:01:52.580789-05" to Doctrine Type datetimetz. Expected format: Y-m-d H:i:s.O

        If I use this format: 'Y-m-d H:i:s.uO' it works.




            
        Hide
        beberlei Benjamin Eberlei added a comment -

        DateTimeTz is created as 'TIMESTAMP(0) WITH TIME ZONE' on DBAL. If you have 'TIMESTAMP(6) WITH TIME ZONE' instead, then you have to create your own datatye.

        Show
        beberlei Benjamin Eberlei added a comment - DateTimeTz is created as 'TIMESTAMP(0) WITH TIME ZONE' on DBAL. If you have 'TIMESTAMP(6) WITH TIME ZONE' instead, then you have to create your own datatye.
        beberlei Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Hide
        ppafford Phill Pafford added a comment - - edited

        Why would this be a new data type? I understand how to fix the problem with creating my own data type to handle the formatting issue and would even suggest just overriding the data type with

                Type::overrideType('datetimetz', 'Doctrine\DBAL\Types\VarDateTimeType');
            Type::overrideType('datetime', 'Doctrine\DBAL\Types\VarDateTimeType');
        
        

        But it's not a new data type, it's a formatting issue.

        Show
        ppafford Phill Pafford added a comment - - edited Why would this be a new data type? I understand how to fix the problem with creating my own data type to handle the formatting issue and would even suggest just overriding the data type with Type::overrideType('datetimetz', 'Doctrine\DBAL\Types\VarDateTimeType'); Type::overrideType('datetime', 'Doctrine\DBAL\Types\VarDateTimeType'); But it's not a new data type, it's a formatting issue.
        ppafford Phill Pafford made changes -
        Description In:

         - vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php

        The function:

            getDateTimeTzFormatString()

        only returns one datetime format:
        {code}
        <pre><code>
            /**
             * {@inheritDoc}
             */
            public function getDateTimeTzFormatString()
            {
                //return 'Y-m-d H:i:sO'; // original format
                return 'Y-m-d H:i:s.uO'; // format also needed
            }

        </code></pre>
        {code}

        Here is the error I get using the original format:

            Could not convert database value "2012-12-07 16:01:52.580789-05" to Doctrine Type datetimetz. Expected format: Y-m-d H:i:s.O

        If I use this format: 'Y-m-d H:i:s.uO' it works.




            
        In:

         - vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php

        The function:

            getDateTimeTzFormatString()

        only returns one datetime format:
        {code}

            /**
             * {@inheritDoc}
             */
            public function getDateTimeTzFormatString()
            {
                //return 'Y-m-d H:i:sO'; // original format
                return 'Y-m-d H:i:s.uO'; // format also needed
            }


        {code}

        Here is the error I get using the original format:

            Could not convert database value "2012-12-07 16:01:52.580789-05" to Doctrine Type datetimetz. Expected format: Y-m-d H:i:s.O

        If I use this format: 'Y-m-d H:i:s.uO' it works.




            

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={expand=changesets[0:20].revisions[0:29],reviews, query=DBAL-397}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            beberlei Benjamin Eberlei
            Reporter:
            ppafford Phill Pafford
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: