Page 1 of 1

Dates and DateTime Pickers

Posted: Thu Jan 05, 2017 4:50 am
by jyoung
I have a date in signed(8) field with the value of 20160410.

I can convert that field (#WSDWP) to a #STD_DATEX with

Code: Select all

#STD_DATEX := #WSDWP.AsDate( CCYYMMDD )
Displaying the date on a label works great with

Code: Select all

#WeekLabel := #STD_DATEX.AsDisplayString( MMsDDsCCYY )
However, when I put that date into a DatePicker, the date is 1 day behind even though the debug value is correct.

Code: Select all

#WeekProcessed.Value := #STD_DATEX
Capture2.PNG
Capture2.PNG (3.34 KiB) Viewed 5677 times
Capture.PNG
Capture.PNG (4.62 KiB) Viewed 5677 times
Getting the date out again works as expected

Code: Select all

#STD_DATEX := #WeekProcessed.Value
#Button1.Caption := #STD_DATEX.AsDisplayString( CCYYMMDD )
How do I get the DateTimePicker to display the correct date?

Re: Dates and DateTime Pickers

Posted: Thu Jan 05, 2017 9:50 am
by Stewart Marshall
Hi Joe

Does setting DisplayasUTC to true solve the problem?

I'm not entirely certain, but I think the displayed date is being adjusted based on your local time rather than GMT. A simple example here shows a time of 10:00:00

A simpler solution for future reference would be to use a date field on the screen instead of the generic prompter.

Regards

Re: Dates and DateTime Pickers

Posted: Fri Jan 06, 2017 1:33 am
by jyoung
Using STD_DATEX instead of the control solved the problem nicely.

Thanks!
Joe