开发者

Android equivalent for BlackBerry DateTimeUtilities

Is there an equivalent Android class to the BlackBerry's DateTimeUtilities? What I really need is DateTimeUtilities.copyCal(source, dest), and I can write it m开发者_StackOverflow中文版yself, but I really hate writing functions like this only to find it already exists but I just didn't know. I am aware of clone(), but what I really need is to be able to easily change the timezone of a date without having to worry about DST etc myself.


Check out Joda Time - Java date and time API


AFter some further review and fiddling I think this is the easiest way to address this issue for me:

public static long applyLocalTimezoneOffsetMillis(long timestampUTC)
{
    long offset = TimeZone.getDefault().getOffset(timestampUTC);
    return timestampUTC - offset;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜