Discussion:
DateTime Component that Supports UTC
(too old to reply)
Russ Weston
2008-07-31 20:58:38 UTC
Permalink
To ???,

Wondering if there is a data-aware DateTime control that reads a
database datetime field (stored in utc format) and displays the value on
the screen with respect to the local bias.

TIA,

Russ Weston
***@commandalkon.com
John Herbster
2008-07-31 21:53:51 UTC
Permalink
Post by Russ Weston
Wondering if there is a data-aware DateTime control that
reads a database datetime field (stored in UTC format)
and displays the value on the screen with respect to the
local bias.
Russ,

You can create your own OnGetText handler for the DB field
that has the TDateTime data and add you own local bias
correction.

However, I have never found that, by itself, to be useful
for historical or future date-times such as are usually
stored in a data tables, because the bias values can
change over time.

Instead, I prefer to record GMT (a.k.a. UT1 or UT2, but not
UTC) *and*, in another field, the local time offset for the
point where the date-time applied or applies. Then in the
display you can change how your OnGetText event handler
controls the correction for bias, using both field, if
required.

Regards, JohnH

PS: Microsoft misuses the term "UTC". UT1, UT2, and GMT days
have 24 hours, with each hour having 60 minutes, and each
minute having 60 seconds, with the seconds synchronized to
the rotation of the earth by stretching or compressing their
length. UTC time is based on constant length seconds with
an occasional 59 or 61 second minute used to synchronize UTC
with the rotation of the earth.
Russ Weston
2008-08-01 16:25:17 UTC
Permalink
Post by John Herbster
Post by Russ Weston
Wondering if there is a data-aware DateTime control that reads a
database datetime field (stored in UTC format) and displays the value
on the screen with respect to the local bias.
Russ,
You can create your own OnGetText handler for the DB field
that has the TDateTime data and add you own local bias correction.
However, I have never found that, by itself, to be useful for historical
or future date-times such as are usually stored in a data tables,
because the bias values can change over time.
Instead, I prefer to record GMT (a.k.a. UT1 or UT2, but not UTC) *and*,
in another field, the local time offset for the point where the
date-time applied or applies. Then in the display you can change how
your OnGetText event handler controls the correction for bias, using
both field, if required.
Regards, JohnH
PS: Microsoft misuses the term "UTC". UT1, UT2, and GMT days have 24
hours, with each hour having 60 minutes, and each minute having 60
seconds, with the seconds synchronized to the rotation of the earth by
stretching or compressing their length. UTC time is based on constant
length seconds with an occasional 59 or 61 second minute used to
synchronize UTC with the rotation of the earth.
John,

Thanks for the response. Tried the OnGetText handler on a DB Field. It
kind of worked when the data was in a TDBGrid or in a TDBEdit control.

I found it interesting that the method did NOT get called when the
control that was displaying the data was a TwwDBDateTimePicker (Note: I
am using Woll2Woll's InfoPower Studio 2007 controls).

I have tried descending a control from InfoPower and adding a UTCMode
property, but the control doesn't seem to surface enough methods for me
to override. I do have the InfoPower source, but don't really want to
change the scope of some of their methods or even modify it.

Anyway, still looking for some for some alternative controls that might
do the job.

TIA,

Russ Weston
***@commandalkon.com
John Herbster
2008-08-01 20:04:40 UTC
Permalink
Post by Russ Weston
Post by John Herbster
Post by Russ Weston
Wondering if there is a data-aware DateTime control that reads a
database datetime field (stored in UTC format) and displays the
value on the screen with respect to the local bias.
You can create your own OnGetText handler for the DB field
that has the TDateTime data and add you own local bias
correction.
Thanks for the response. Tried the OnGetText handler on a DB
Field. It kind of worked when the data was in a TDBGrid or in a
TDBEdit control.
I found it interesting that the method did NOT get called when the
control that was displaying the data was a TwwDBDateTimePicker
(Note: I am using Woll2Woll's InfoPower Studio 2007 controls).
...
I> I have tried descending a control from InfoPower and adding a
UTCMode
Post by Russ Weston
property, but the control doesn't seem to surface enough methods
for me to override. I do have the InfoPower source, but don't
really want to change the scope of some of their methods or even
modify it.
Russ, I see that you are chasing the problem. It is difficult to
believe that
the DBDateTime pickers don't allow a timezone-bias adjustment in the
display. Please let us know if you find anything. Rgds, JohnH

Loading...