Request for Elements RTL/DateTime

Could someone add the following methods to the Elements.RTL.DateTime class?

ToOADate(ADateTime: DateTime): Double;
DateTime.FromOADate(AOADate: Double): DateTime;

Thanks!

That seems to be pretty Windows-platform specific? Wouldn’t it be ok to simply access the inner native System.DateTime for this?

The reason for the request is this. We have built a database that stores dates as doubles (OADates) extensively. From .NET thus isn’t an issue. From DA / Cocoa it now is. I could write my own routine but thought elements RTL would be a good place for it.

Gotcha, yes, i can see how it would be helpful. is OADate the same format Delphi uses (which i know is double based), do you know? if so, we might already have this in Delphi RTL, and i coukld migrate it down. If not, do you have an algorithm handy i can reuse (either raw, or as a finished pull request for Elements RTL)?

Yes exactly the same as Delphi. That is probably why the db was designed this way due to Delphi’s date storage since at the time all was being written in Delphi. I don’t have any code currently but if you have something in the Delphi RTL we should be good!

Thanks

thanx. will have a look tomorrow.

Is there any update on this by chance?

Not yet, sorry. weekends, holidays, docs writing and stuff got in the way :wink:

Thanks, logged as bugs://79317

bugs://79317 got closed with status fixed.

1 Like

Thanks! Where was this added?

It’s in there GitHub repo (https://github.com/remobjects/rtl2), and should be in next Friday’s beta.