ProBindingSource:InputValue returns wrong value for DATETIME

Posted by rvkanten on 05-Jan-2010 08:43

Platform: Windows XP SP3 32-bit

Version: 10.2B

We have a ProDataSet consisting of 1 temp-table which contains several DATETIME-TZ fields.

We've noticed a discrepancy between the BUFFER-VALUE of DATETIME-TZ fields and the value returned by the InputValue property.

For example a BUFFER-VALUE of "09/15/2009 23:00:00+02:00" is returned as "09/16/2009 1:00:00" by InputValue.

This seems like a bug or are we doing something wrong?

Here is some example code:


DEFINE VARIABLE lbs_Test     AS Progress.Data.BindingSource.
DEFINE VARIABLE lhn_Buffer   AS HANDLE      NO-UNDO.
DEFINE VARIABLE lhn_DataSet  AS HANDLE      NO-UNDO.
DEFINE VARIABLE lhn_TopQuery AS HANDLE      NO-UNDO.

DEFINE TEMP-TABLE ltt_Test NO-UNDO
    FIELD TestDZ AS DATETIME-TZ.
DEFINE DATASET lds_Test FOR ltt_Test.

CREATE ltt_Test.
ASSIGN ltt_Test.TestDZ = NOW
       lhn_DataSet     = DATASET lds_Test:HANDLE
       lhn_TopQuery    = lhn_DataSet:TOP-NAV-QUERY(1)
.
lhn_TopQuery:QUERY-PREPARE("FOR EACH ltt_Test":U).
lhn_TopQuery:QUERY-OPEN.
lbs_Test = NEW Progress.Data.BindingSource(lhn_DataSet,
                                           TEMP-TABLE ltt_Test:DEFAULT-BUFFER-HANDLE,
                                           "*",
                                           "").
lhn_Buffer = lhn_DataSet:GET-BUFFER-HANDLE("ltt_Test":U).
lhn_Buffer:FIND-FIRST.
MESSAGE lhn_Buffer::TestDZ SKIP
    lbs_Test:InputValue["TestDZ"]
    VIEW-AS ALERT-BOX.
lhn_TopQuery:QUERY-CLOSE.

Kind regards

All Replies

Posted by Admin on 05-Jan-2010 11:11

Did you try

UNBOX(lbs_Test:InputValue["TestDZ"]) ???

Posted by rvkanten on 05-Jan-2010 14:05

Mike,

I've tried UNBOX as you've suggested but the result is the same.

It looks like the timezone offset is applied twice.

Posted by rvkanten on 06-Jan-2010 07:49

The BOX function also returns the wrong value (timezone offset is falsely applied):

DEFINE VARIABLE ldz_Date AS DATETIME-TZ   NO-UNDO.
DEFINE VARIABLE lob_Date AS System.Object NO-UNDO.


ASSIGN ldz_Date = DATETIME-TZ("15-12-2009 23:00:00+01:00":U)
       lob_Date = BOX(ldz_Date)
.
MESSAGE "DATETIME-TZ:" ldz_Date SKIP
    "DATE:" DATE(ldz_Date) SKIP
    "MTIME:" MTIME(ldz_Date) SKIP
     "System.Object:" lob_Date
VIEW-AS ALERT-BOX.


This thread is closed