Timestamp conversion from local to UTC and vice versa

My use case is TMS Webcore and Windows Server. However, I am wondering how others have handled timezone conversions.

I am saving datetime as timestamp on server (MySQL).

  • Displaying it on grids on controls can be achieved in a number of ways such as
    • GetText event
    • Using non DB aware controls and displaying after conversion
  • However, editing is a tad more complex.
    • I don’t like the idea of using GetText and SetText
    • I could use AfterOpen and BeforePost, but if something goes wrong, the dates are in the wrong state
    • Apparently FireDAC has support for zones in Params, but this wont work for 3-tier or in webapps.

Is it stored as UTC ?

Yes its stored as UTC

I don’t have an answer for this - but VCL is the wrong category for this - moving it to third party

Hi Vincent, although I am implementing it in TMS Webcore. I was looking to see how others had done it in VCL… which is why I had put it in the VCL cubbyhole.

Then I could decide how to implement it for my case.

Although I am leaning towards one of these

  1. Send the client timezone to the web-server via an HTTP header, and let the server take care of it.
  2. Implement a helper class on TDBEdit / TDBDateEdit / TDBDatePicker or whichever control I decide to use. This would give me a solution for VCL-clients too (for futurre).

There is an option 3, to implement a helper class for TDateField, but this has limited support in TMS.