Skip to content

support for timestamp with timezone (Firebird 4+) #55

@kuerbis

Description

@kuerbis

Hi, when I use a timestamp with timezone in dateadd, the result is unknown. The Firebird version is '4.0.4'.


my $dbh = DBI->connect( "dbi:Firebird:dbname=$db", $user, $passwd ) or die DBI->errstr;

my $table = 'test_table_unix_seconds';
my $col = 'sec';

$dbh->do( "RECREATE TABLE $table ($col INT)" );
$dbh->do( "INSERT INTO $table ($col) VALUES(86400)" );

my $sth = $dbh->prepare( "SELECT $col, dateadd(SECOND,$col,TIMESTAMP '1970-01-01') FROM $table" );
$sth->execute();
$sth->dump_results;
# 86400, 'Fr 02 Jan 1970 00:00:00 CET'

$sth = $dbh->prepare( "SELECT $col, dateadd(SECOND,$col,TIMESTAMP '1970-01-01 UTC') at time zone 'CET' as ts FROM $table" );
$sth->execute();
$sth->dump_results;
# 86400, '** unknown **'

It works using isql:

#SQL> SELECT sec, dateadd(SECOND,sec,TIMESTAMP '1970-01-01 UTC') at time zone 'CET' as ts FROM test_table_unix_seconds;
#
#         SEC                                                        TS
#============ =========================================================
#       86400 1970-01-02 01:00:00.0000 CET

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions