1. mike S
  2. PowerBuilder
  3. Wednesday, 14 February 2024 16:22 PM UTC

PB 2022 R3:

 

If you add a date using the jsongenerator::   

objectname.AddItemDate ( ParentItemHandle, Value )

 

the json created is a string: {"mykey":"2017-09-21"}. 

Instead, I expected it to add a date since, i told it to add a date and not a string.

 

this is what i expected it to look like:

ls_Json = '{"datetime":7234930293, "date": "2017-09-21"}'

or maybe

ls_Json = '{"date":7234930293, "date": "2017-09-21"}'

 

 

I should be able to use the jsonparser object GetItemType to get the type.  Its weird that it won't actually return the type of date, but instead returns JsonObjectItem! which then requires another getitemstring to see what the time is.  but in any case, it does none of that, but instead returns string as the type.

 

what is supposed to happen here?

 

 

 

 

 

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 14 February 2024 16:36 PM UTC
  2. PowerBuilder
  3. # 1

Hi Mike;

  Please try ... 

objectname.AddItemDate ( ParentItemHandle, Date ( Value ) )    // OR

use a Date data type as the Value variable argument

HTH

Regards .. Chris

Comment
  1. mike S
  2. Wednesday, 14 February 2024 17:18 PM UTC
the datetype is date
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 14 February 2024 20:30 PM UTC
Hi Mike;

The PB will serialize dates according to the ISO 8601 standard for Date as a string.

Regards .. Chris

  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.