开发者

Android Time Zone UTC to current conversion not working

开发者 https://www.devze.com 2023-02-04 02:21 出处:网络
Im trying to converta given date formated in UTC timezone and then converting to the current timezone. But its not working properly, here\'s the code:

Im trying to convert a given date formated in UTC timezone and then converting to the current timezone. But its not working properly, here's the code:

public String CurrentTimeZone(Date value){

    SimpleDateFormat sdf= getReaderFormatter();
    sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
    sdf.format(value);
    return getCur开发者_StackOverflow社区rentTimeZone().format(value);
}

The problem is that the date value still remains in the current time zone after formating it with the UTC one, so the conversion ends up being from "current timezone -> current timezone" and not UTC timezone -> current timezone....

0

精彩评论

暂无评论...
验证码 换一张
取 消