Skip to content Skip to sidebar Skip to footer

Inserting Firebase Date Field On Sqlite As String With Simpledateformat

I am receiving a child change from Firebase, but when I insert into SQLite, it gives me a warning. The insertion was success, but how do I fix this warning? W/ClassMapper: No sette

Solution 1:

It looks like you're expecting this Firebase object:

"data_validade":{"date":29,"day":0,"hours":10,"minutes":34,"month":0,"seconds":36,"time":1485693276834,"timezoneOffset":120,"year":117}

To map to this field:

privateDate data_validade;

The warnings come from the fact that Date has no setDay() and no setTimezoneOffset() to match those fields in the object. Really, this is not the best way to store a date in Firebase.

If you want to store a date in Firebase, just use a long integer. If you then need to convert that to a Date, just create a new Date with "new Date(long)". If you need to convert a Date into a long, use date.getTime().

Post a Comment for "Inserting Firebase Date Field On Sqlite As String With Simpledateformat"