小编Her*_*ang的帖子

读取"yyyy-MM-dd'T'HH:mm:ss.SSSSSSZZZZZ"时java.text.SimpleDateFormat的输出错误

我试图通过使用java.text.SimpleDateFormat将String格式的日期转换为java.util.Date,但是它没有给我正确的输出.请帮忙!

我的输入是由Django date生成的:ex."2014-01-20T07:17:06.150995 + 00:00"

但是,我得到了"Mon Jan 20 15:19:36 GMT + 08:00 2014"而不是"Mon Jan 20 15:17:06 GMT + 08:00 2014"

这是我的测试代码:

String s = "2014-01-20T07:17:06.150995+00:00";

SimpleDateFormat sdf;
String fmt = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSZZZZZ";
sdf = new SimpleDateFormat(fmt, Locale.US);

String result = "";
try {
    Date date = sdf.parse(s);
    Log.d(Constants.LOG_TAG, date.toString());
    result = date.toString();
} catch (Exception e) {
    Log.d(Constants.LOG_TAG, "date formatting error" + e.getMessage());
}
Log.d(Constants.LOG_TAG, "date test >> " + result);
Run Code Online (Sandbox Code Playgroud)

java formatter simpledateformat

4
推荐指数
1
解决办法
1353
查看次数

Qt Mac应用程序无法创建自包含应用程序包(Qt Creator Build)

我使用的是Qt Creator 3.6.1Qt 5.6.0 (Clang 7.0 (Apple), 64 bit)了,我遇到了一些问题,而试图创建一个用于部署的应用程序包.

注意:调用应用程序名称 bibi

  1. Qt Creatorbibi.appbuild-bibi-Desktop_Qt_5_6_0_clang_64bit-Release/文件夹下成功生成
  2. bibi.app无法在其他Mac上成功链接Qt
  3. macdeployqt 没有解决问题

以下是详细信息:

bibi.app在其他Mac上运行时出现错误截图:

otool

> otool -L build-bibi-Desktop_Qt_5_6_0_clang_64bit-Release/bibi.app/Contents/MacOS/bibi
build-bibi-Desktop_Qt_5_6_0_clang_64bit-Release/bibi.app/Contents/MacOS/bibi:
    @rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.0)
    @rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.0)
    @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.0)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version …
Run Code Online (Sandbox Code Playgroud)

macos qt otool dyld macdeployqt

2
推荐指数
1
解决办法
1261
查看次数

标签 统计

dyld ×1

formatter ×1

java ×1

macdeployqt ×1

macos ×1

otool ×1

qt ×1

simpledateformat ×1