【问题标题】:Windows Azure Date Format to Java DateWindows Azure 日期格式到 Java 日期
【发布时间】:2013-08-13 18:11:53
【问题描述】:

例如,我正在从 Azure 中检索 JSON,并以 1900-01-01T16:00:00.000Z 形式接收日期。现在是 JSONObject 的这一部分,但是如何正确地将其解析为 Java 日期格式?

感谢您的任何想法

【问题讨论】:

标签: java json datetime azure


【解决方案1】:

将日期作为字符串从 Json 中获取,然后使用 SimpleDateFormat 解析它:

SimpleDateFormat sdf=new SimpleDateFormat("/*Look at the API for the format*/");
Date jsonDate= sdf.parse(/*Date as String from your JSON*/);

要找到正确的格式,您可以查看这个问题simpledateformat parsing date with 'Z' literal

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-29
    • 2011-11-16
    • 1970-01-01
    相关资源
    最近更新 更多