Friday, 15 April 2011

android - Loopback + AndroidSDK: Retrieving Date fields -


I have a loopback API working as a backend for an Android app. I save MySQL data I am using All tables have at least one date time zone. Of course, I need to retrieve them.

I get this date time zone correctly by using the API Explorer:

  {"id": 1, ... "DtDateAdded": "2014 -06-10T16: 42: 36.000Z "," DTLestModified ":" 2014-10-01T00: 00: 00.000Z "}  

Therefore date fields have been received properly DB.

But when I retrieve data from the Android app, the date field is zero.

This model is defined as:

  Public class MyModel Model {Private Int id; Private Deliastastodified; Public int getId () {return ID; } Public Zero Set Id (Ent ID) {this.Id = Id; } Public Date getDtLastModified () {Return DtLastModified; } Public Zero Set Deliverability Modified (Date DTL Ampfide) {this.DtLastModified = DtLastModified; }}  

Code to retrieve data:

  repository.findAll (new list callback  () {@ Override success on public zero (list & lt; MyModel & gt; list) {for (int i = 0; i  

correctly outputs logout ID But the date field is zero.

Loopback Android SDK currently supports "advanced" data types Does not patch.

The dates are presented in JSON as strings: "2015 -03-24 T18: 00: 09.975Z". You need to create a setter which accepts the string And it changes (possibly using an external date / time library).


No comments:

Post a Comment