IUtil.decodeTimeTz - need help to get the correct time

108 views
Skip to first unread message

A. Maier

unread,
Jan 13, 2024, 9:29:18 AMJan 13
to firebird-support
I use the following SQL commands:

set time zone 'America/Sao_Paulo';
select localtime, current_time from rdb$database;

When I query the time I get an unexpected result.
Example output:
  11:19:07 (IUtil.decodeTime / isc_decode_sql_time)
  12:19:07 America/Sao_Paulo (IUtil.decodeTimeTz)

I determine the (2nd field) time with time zone with decodeTimeTz (IUtil).
I also created a small test project for this.

In it I create a connection to the DB, execute the two SQLs and read the values. What should i pay attention with decodeTimeTz so that i get the correct value?

Thanks for your help.

Andy
FBTimeTZTest.7z

A. Maier

unread,
Jan 13, 2024, 9:35:17 AMJan 13
to firebird-support
I forgot to mention:
Firebird Version "LI-V4.0.4.3010 Firebird 4.0" -
(runs under "Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux")

I also tested on windows and had the same problem.

Mark Rotteveel

unread,
Jan 13, 2024, 9:37:47 AMJan 13
to firebird...@googlegroups.com
I'm not sure if it is relevant, but for CURRENT_TIME, effectively the
timezone rules on 1-1-2020 are applicable. To be honest, using TIME WITH
TIME ZONE is almost always the wrong solution.

Mark
--
Mark Rotteveel

A. Maier

unread,
Jan 14, 2024, 9:10:46 AMJan 14
to firebird-support

Thanks for your answer.
I see your point. However, with CURRENT_TIME I would also assume that the current date is used and therefore the time zone is handled correctly.
I also have the same problem with CURRENT_TIMESTAMP.
I have expanded my example and attached a new version.
Greetings Andy
FBTimeTZTest-v2.7z
Reply all
Reply to author
Forward
0 new messages