Dates and DateTime Pickers

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Dates and DateTime Pickers

Post 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 5675 times
Capture.PNG
Capture.PNG (4.62 KiB) Viewed 5675 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?
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Dates and DateTime Pickers

Post 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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Dates and DateTime Pickers

Post by jyoung »

Using STD_DATEX instead of the control solved the problem nicely.

Thanks!
Joe
Post Reply