Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8662649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:47:03+00:00 2026-06-12T16:47:03+00:00

After upgrade to PHP 5.3 my application is returning DB2 columns with Timestamp type

  • 0

After upgrade to PHP 5.3 my application is returning DB2 columns with Timestamp type as “2010-12-15-10.23.22.716000”.
This is causing problem for PHP DateTime function , as it fails with

$time = new DateTime(“2010-12-15-10.23.22.716000”);

Failed to parse time string (2010-12-15-10.23.22.716000) at position 25 (0): Unexpected character

It seems its having a problem with too much accuracy in DB2 timestamp.
Can I somehow force connection to change timestamp format with it is fetching data into?

I am connecting to database with db2_connect function like this:

$this->connection = db2_connect ( $config [‘dsn’], $config [‘username’], $config [‘password’] );

Edit:
I would like to use solution mentioned below, but its not working for me and on my system (AS400) it runs weird.
I have:
$timeRec = DateTime::createFromFormat(‘Y-m-d-h.i.s.u’,$value);

$value = $timeRec->format('Y-m-d H:i:s');

$value = new DibiDateTime($value);

If I do var_dump($value) after ->format, correct string is returned, but if I try feed this string to DibiDateTime, that has:

public function __construct($time = 'now', DateTimeZone $timezone = NULL)
{    
    if ($timezone === NULL) {
        parent::__construct($time);
    } 
}   

then it fails with:

function format() on a non-object

Even when I checked before with var_dump($timeRec) is proper DateTime object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:47:05+00:00Added an answer on June 12, 2026 at 4:47 pm

    I think your function (whichever it is) is choking on the microseconds at the end of your date string. Use the DateTime::createFromFormat() function to cope with this using the ‘u’ microsecond tag. See here http://php.net/manual/en/function.date.php

    $time = DateTime::createFromFormat('Y-m-d-h.i.s.u', '2010-12-15-10.23.22.716000');
    var_dump($time);
    

    Output on my system:-

    object(DateTime)[1]
      public 'date' => string '2010-12-15 10:23:22' (length=19)
      public 'timezone_type' => int 3
      public 'timezone' => string 'UTC' (length=3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having a problem where we run an upgrade for our web application. After
A .NET 4.0 application needs to run without errors after system upgrade from Windows
After I upgrade to Node 0.6.18, I got the error: listen EINVAL when start.
Is there a way i can uninstall (and dont upgrade after) a previous version
After a system upgrade i am no longer able to start my tomcat5 server.
This is a warning that began to appear after I upgraded my app from
I've upgraded Resharper from 5 version to 6 version. After that when I type
I have developed module with sql script upgrade and after that my phpunit tests
I tried to install xampp (I downloaded xampp-win32-upgrade-1.7.2-1.7.3). After I finish extracting it gives
I upgraded my ubuntubox from 10.10 to 11.04 and after that i have problem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.