I have this date string : 2016-04-26T09:14:10.477Z
which is in UTC timezone. I want to convert it to the user local Timezone, so if it is GMT +02:00, I want a date with a value of 2016-04-26T11:14:10.477Z
(note the 9 changes to 11).
I've been using this so far :
val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault())
val now = Date()
val limit = sdf.parse(coupon.usedAt)
Here limit = Tue Apr 26 09:14:10 GMT+02:00 2016
which is not correct I suppose.
So how can I convert it correctly? Thanks!
Edit : my question differs from this one, since I need to use the object SimpleDateFormat
and not the Date
one