Jump to content
gkobler

New Firebird 4 datatype "TIMESTAMP WITH TIMEZONE"

Recommended Posts

Does anyone have experience with Firebird 4, D11.3, FireDAC and the new data type "TimeStamp with Time Zone"? I would like to show the time zone in my field, have no idea to show it.

  

Thanks in Advanced

Share this post


Link to post

Testing D12, I made small tests.

 

First using 2 versions of Firebird (3 and 4) I made a mistake not using a TFDPhysFBDriver, default connection was using fb3 this mistake stop IDE !
 

FDPhysFBDriver settled
image.png.192f39d5c499c9b81a2ee91dbc7ce353.png

 

I now run in another error with my French edition
image.png.63cc8b318969f29b83d7b3a9f5999c65.png

 

working with SQL
image.thumb.png.27d628130e3f5d853418ef8d26240bc0.png

 

To search :
 using FormatOptions (of the FDConnection.FDQuery or FDTable)
 using mappings
 

Share this post


Link to post
14 hours ago, weirdo12 said:
Quote

Note: Firebird 4.0 client may need some ICU files if you want to work with datatypes like TIMESTAMP WITH TIME ZONE and TIME WITH TIME ZONE. For further information click here.

https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Connect_to_Firebird_(FireDAC)

Makes not diffenrent, if the icu files there or not (same directory how the exe file).

 

3 hours ago, Serge_G said:

 

FDPhysFBDriver settled
image.png.192f39d5c499c9b81a2ee91dbc7ce353.png

 

I'm sure i use the new fbclient.dll from FB4.

 

 

3 hours ago, Serge_G said:

working with SQL
image.thumb.png.27d628130e3f5d853418ef8d26240bc0.png

CAST is working, but for me it's just a workaround, and works with Querys not with Tables. In my opinion, when you add the fields, it will create a TSQLTimeStampField insted of a TSQLTimeStampOffsetField!

 

The TSQLTimeStampOffsetField is what i need i think, because it has information about the timezone. But it's not possible to replace the field, you got an error

 

But thanks for showing me a other point of view.

Share this post


Link to post

@Dmitry Arefiev My tests was with Delphi 12 first. Some links or clues ?

21 hours ago, gkobler said:

CAST is working, but for me it's just a workaround,

Agree, even if I rarely use FDTable 😉

Share this post


Link to post
On 11/11/2023 at 2:13 PM, Dmitry Arefiev said:

Support for TIMESTAMP WITH TIMEZONE and TSQLTimeStampOffsetField in FireDAC is introduced in Delphi 12.

Didn't saw this changes on any note. But thanks, will try it next week.

Share this post


Link to post
On 11/11/2023 at 2:13 PM, Dmitry Arefiev said:

Support for TIMESTAMP WITH TIMEZONE and TSQLTimeStampOffsetField in FireDAC is introduced in Delphi 12.

Now i tryed the same test with D12, i can confirm that the Field are created as TSQLTimeStampOffsetField.

 

image.thumb.png.613aad00cc0606c8a2bf38174efc4011.png

 

But when i open the table now i got an exception (invalid argument could not convert the time)

 

image.thumb.png.eb7f689410d1000c9f4f9ec232ae316c.png

 

After that i add a GetText Methode

 

procedure TForm1.FDTable1MONTIMESTAMPGetText(Sender: TField; var Text: string; DisplayText: Boolean);
begin
  text:=Format('%s UTC(%d:00',[DateTimeToStr(Sender.AsDateTime),Sender.AsSQLTimeStampOffset.TimeZoneHour]);
end;

 

It will shows the follow result??

image.png.e0c72700e410a7f49b0ca801a97ec3d0.png

 

756 Hours? When i look to the help file, it should be -12 .. +13 Hours! Also the property TimeZoneMinuts shows me 696

 

Did i found a bug?

 

 

 

Edited by gkobler

Share this post


Link to post

Same thing for me !  I tried your sample, giving me a  326 value for a GMT one

image.png.20a5359d18deaad5ade8fbd088a4f794.png

Then I wrote this simple code

procedure TForm1.FDQuery1MONCREATION_DATEGetText(Sender: TField;
  var Text: string; DisplayText: Boolean);
begin
text:=sender.asString;
end;

Giving me an "Incorrect argument for time encoding. " error  with my french version

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×