Subject Re: [firebird-php] inserting timestamp values (now really)
Author Yves Glodt
On Monday 30 April 2007, Yves Glodt wrote:
> On Monday 30 April 2007, Alan McDonald wrote:
> > > Hello,
> > >
> > > it seems I am unable to insert any value into a TIMESTAMP column which
> > > is different of 'NOW'.
> > >
> > > I set the following:
> > >
> > > ini_set('ibase.timestampformat', '%d.%m.%Y - %H:%M');
> > >
> > > ...and this seems to work well for formatting the displayed
> > > resultset, but the
> > > format of the dates to be inserted seems to be unaffected by this...
> > >
> > > Is there any other fixed format I need to use when I insert
> > > timestamp data?
> > >
> > >
> > > best regards,
> > > yves
> > >
> > > p.s.
> > > sorry for the previous prematurely sent mail
> >
> > actually, the most reliable way I have found to insert/update dates is to
> > use the long date string
> > April 30, 2007
> >
> > It gets over all forms of localisation
>
> I had success with this, but as soon as I add a time value, it does not
> work anymore...
>
> I read that internally, firebird passes the formatstring to strftime().
>
> So I tried to put %s, which is the unix timestamp since the epoch, and even
> that fails.
>
> It seems the format for inserting is not at all related to the
> ibase.timestampformat setting, but to some system variable/setting (Since
> on my dev.-box it just works with '26.04.2007 - 11:59' e.g.)
> phpinfo() does not show any pointer to where it gets that format from.
>
> I will investigate more.

Eventually I found out that when I include the date in the statement as a
string, e.g. "insert into ... values (...,'01.01.2007 - 23:59:59',...)"
firebird is less picky, and accepts different kinds of date formats.

However, inserting with parameterized statements using ibase_execute(sth,
$par1, $par2, ...) I can not insert anything else than $par1='NOW';


And the worst is. I can only reproduce it on my debian sarge box with the
shipped firebird 1.5.1, and selfcompiled php 5.2.2.

Debian unstable, with shipped firebird 1.5.3 and php 5.2.2 works fine.
grmbl.

Best regards,
yves




> yves
>
> > Alan