0

I'm reading in an Object from JSON API. The object is as follows...

"current_form_details": {
"key": 9,
"form_name": "Pre Surgery Functional Assessment - Knee",
"date_available": 1521155679

This is straight from my Logcat...

Now what I am doing is taking this time stamp and using it to show the "date_available" in MM/DD/YYYY and also comparing that to the current time to show the amount of time it has been available in days.

My issue is that when I'm call my getter on my model, something like

survey = model.getCurrentFromDetails();

it returns correct 'key and form_name' but it sets the date available to the moment I launched the app which I guess is when the survey became "available" in a literal sense. I'm having trouble understanding why the 'date_available' is updating to the current date/time when it already has a value in the JSONObject.

Thanks

Kyle
  • 695
  • 6
  • 24
  • my guess is the logic you have that you have not showed us is the problem. if you model.setCurrentFromDetails correctly, then get it as a string value. get the current time as a string value. and then compare. I don't think you are showing us everything we need to see to solve your issue. – letsCode Mar 16 '18 at 19:27
  • I’m wondering why you say to set as a string rather than a long. For comparison reasons only? The value of the date_available attribute is a long or int – Kyle Mar 16 '18 at 19:33
  • string value is a mistake, sorry. – letsCode Mar 18 '18 at 00:27

1 Answers1

0

Ending up being issue with API. Had to be fixed on that end

Kyle
  • 695
  • 6
  • 24