#1 2025-11-20 05:18:17

ertank
Member
Registered: 2016-03-16
Posts: 186

Converting all datetime values in a record to localtime

Hello,

I am using Delphi 12.3 and looking for an advise on a way to convert all TDateTime variables values from GMT+0 to a different GMT in a packed record which has lots of other variables and different data types.
What I am looking for is something like an utility function that I do not need to use record variable names in code.

Is that possible? Or I still need to change all of them one by one in classical way.

Thanks & Regards,
Ertan

Offline

#2 2025-11-20 07:28:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,293
Website

Re: Converting all datetime values in a record to localtime

record or class?

You can use TRttiCustom.Props do check for TDateTime fields.

Offline

#3 2025-11-20 10:06:54

ertank
Member
Registered: 2016-03-16
Posts: 186

Re: Converting all datetime values in a record to localtime

Thank you for the help.
I need it for record

Offline

#4 2025-11-21 08:46:03

rvk
Member
Registered: 2022-04-14
Posts: 143

Re: Converting all datetime values in a record to localtime

For completeness, here is a example changing all TDateTime in a record using TRttiContext in Delphi:

https://gist.github.com/rvk01/6a1cba7da … f4dc5ed407

Offline

Board footer

Powered by FluxBB