1. Frank Bartsch
  2. PowerBuilder
  3. Friday, 26 January 2018 14:56 PM UTC

Hi,

I just migrated my project to PB 2017 1681 and run into an error because the behavior of the powerscript function date(string) appears to be changed. In PB 12.6 this:

date('2018-01-53') returns 1900-01-01, what I need.

But in PB 2017 it returns 2018-01-05.

I couldn't find any information about changes. Does anyone know something about?

Thanks,
Andre

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 26 January 2018 17:04 PM UTC
  2. PowerBuilder
  3. # 1

Hi Frank;

   I just tested your code snippet in PB 2017 R2 release coming out next week and it (unfortunately) behaves the same by returning the value 2018-01-05. When I test your code in PB 12.6, it returns 1900-01-01 - as you expected.

  Looks like this is definitely an Appeon PB bug. Please open a Support Ticket for this issue to that our Support & Engineering teams can address this problem ASAP. In the mean-time, I will contact them today to make them aware of your issue.

Regards ... Chris

Appeon: Director, Developer Relations

Comment
  1. Gerry Whitmarsh
  2. Sunday, 28 January 2018 10:50 AM UTC
Hi Chris,



It is so refreshing to see that issues are seen and acted upon as opposed to the Sybase/SAP debacle.



Gerry.

  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 26 January 2018 15:21 PM UTC
  2. PowerBuilder
  3. # 2

I also wouldn't expect "2018-01-05" and don't recall it mentioned in the "what's new" release notes.

In any case, you can check the text for valid date using this >

IF IsDate(myText) THEN

   myDate = Date(myText)
​END IF

HTH / Michael

Comment
  1. Frank Bartsch
  2. Friday, 26 January 2018 15:34 PM UTC
That's annoying because I've used it in so many cases...



Nevertheless, thank you Michael!

  1. Helpful
  1. Michael Kramer
  2. Friday, 26 January 2018 16:33 PM UTC
I know, and you should still report the bug.



Nevertheless, it is a workaround.



- - - - Further testing revealed:





Invalid date in general returns 1900-01-01

IF value is invalid date BUT (value having last character removed) is valid



THEN this truncated value is returned

ELSE 1900-01-01 is returned





Examples

2018-13-01 => 1900-01-01

2012-12-153  => 2012-12-15

2018-10-310 => 2018-10-31

2018-09-310 => 1900-01-01

2018-09-309 => 2018-09-30

2018-09-43 => 2018-09-04

2018-09-4X => 2018-09-04





 

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.