Convert UTC to current locale time

后端 未结 7 1009
时光取名叫无心
时光取名叫无心 2020-11-27 03:20

I am downloading some JSON data from a webservice. In this JSON I\'ve got some Date/Time values. Everything in UTC. How can I parse this date string so the result Date objec

相关标签:
7条回答
  • 2020-11-27 03:36

    It has a set timezone method:

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    Date myDate = simpleDateFormat.parse(rawQuestion.getString("AskDateTime"));
    

    all done!

    0 讨论(0)
提交回复
热议问题