Page 1 of 1

How to migrate TDateTimeField to TZDateTimeField?

Posted: 14.12.2023, 18:10
by shmorsecode
Hi

I've been tasked with upgrading a large project that used ZeosLib 6.5.1 from Delphi 2007 to Delphi 10.2.
The original authors of the project had a habit of adding persistent fields everywhere, so obviously I ran into type mismatch on every field when opening any TZQuery. I wrote a program to help me with updating the classnames (wish I could just nuke the fields, but I can't, spaghetti is too strong).

Anyways, I'm not sure how to deal with TDateFimeField - specifically it's DisplayFormat and EditMask fields.
I understand that DisplayFormat is now TZDisplayTimestampFormatSettings, and there is now both EditMask and EditFormat, but given this example:

Code: Select all

object QList_time: TDateTimeField
   FieldName = 'time'
   DisplayFormat = 'dd-mm-yyyy hh:mm'
end
object QList_deadline: TDateTimeField
   FieldName = 'deadline'
   EditMask = 'dd-mm-yyyy'
end
Which properties of TZDateTimeField need to be set to what values, in order to preserve the original behavior?

Re: How to migrate TDateTimeField to TZDateTimeField?

Posted: 15.12.2023, 16:18
by marsupilami
Hello shmorsecode,

Zeos now allows to use much more detailed settings than were available with Delphi. The DisplayFormat equivalent of TZDateTimeField is DisplayFormat.Format. The following are lines from an application that we develop:

Code: Select all

  (DataSet.FieldByName('VON') as TZTimeField).DisplayFormat.Format := 'hh:nn';
  (DataSet.FieldByName('BIS') as TZTimeField).DisplayFormat.Format := 'hh:nn';
The EditMask of TZDateTimeField still should be EditMask. There should be no changes for the EditMask property.

Best regards,

Jan