Reputation: 4678
I am trying to insert date time in sqlite. The date time is coming from server response (UTC format) in json format.Now When I get date from json as a string field and inserting in sqlite it does not save in utc format. What can be the possible reason I am not getting why is this happening? Is the default behavior of sqlite and I need to date time format again before inserting into sqlite?
This is the date time format in UTC I am getting from response in json
"TransactionDate":"2016-04-05T11:21:16.29Z",
After inserting date time when I am checking in database it is saved in local date time format. like below
2016-04-05 16:03:45.000
Upvotes: 0
Views: 600
Reputation: 1763
You can see SQLite's behaviour in the Formats how you can save datetimes Link to Documentation, so basically yes, you have to format your Date/Time again.
Personally I align my values to UTC+0 and use Locales to format them, so I don't have to add an extra "UTC +X" Field in my DB.
Upvotes: 2