- Konstantin Goldobin
- PowerBuilder
- Monday, 9 October 2023 09:51 AM UTC
Hello,
I stumbled upon an old piece of code that converts the text of an Edit Mask window control to a date value using the Date() function instead of using the GetData() method. The mask is "[date]" and the MaskDataType is "datemask!".
On one particular PC configured with the "dd.MM.yyyy" date format, this code interprets the text differently depending on its value: if the first two digits can be converted to a month, it does so. If not, it converts them to a day number. For example, "14.09.2023" is correctly converted to 2023-09-14, but "12.09.2023" is converted to 2023-12-09.
I created a simple test app that does the same and the following is the result on that troublesome PC:
The "Suggested" row shows the result of using the GetData() method, however I would really like to understand what is happening here. So, I was wondering if anyone has any idea what can influence the string to date conversion apart from the date format set in Windows. I don't know if this is version specific, but I'm using PB 2019 R3 build 2728.
Thanks!
Konstantin
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.