Java 安卓:时间戳不显示设备时间

Java 安卓:时间戳不显示设备时间,java,android,timestamp,chat,timestamp-with-timezone,Java,Android,Timestamp,Chat,Timestamp With Timezone,您好,我需要显示时间戳,但我没有得到正确的输出。这里是我的编码。您可以检查我的代码并更正我的错误。我的代码只显示UTC时间,而不显示设备时间 // show dateTime viewHolder.dateTime.setVisibility(View.VISIBLE); DateTime createdAt = message.getCreatedAt(); LBLog.v(TAG, "createdAt = " + createdAt.toS

您好,我需要显示时间戳,但我没有得到正确的输出。这里是我的编码。您可以检查我的代码并更正我的错误。我的代码只显示UTC时间,而不显示设备时间

// show dateTime

        viewHolder.dateTime.setVisibility(View.VISIBLE);
        DateTime createdAt = message.getCreatedAt();
        LBLog.v(TAG, "createdAt = " + createdAt.toString());
        LBLog.v(TAG, "createdAtMillis = "  + createdAt.getMillis());
        DateTimeFormatter fmtTimeBubble = DateTimeFormat.forPattern(LBUtil.TIME_AM_PM_FORMAT);
        viewHolder.dateTime.setText(fmtTimeBubble.print(createdAt));
    }

    // update divider here
    DateTimeFormatter fmt = DateTimeFormat.forPattern(LBUtil.MONTH_DD_YEAR_FORMAT);
    DateTime dividerDateTime = message.getCreatedAt();
    viewHolder.dividerTextView.setText(fmt.print(dividerDateTime));
请检查此项,我需要这样的时间戳:
我想你从来没有设置过时区。先设置时区,然后运行,希望它对你有用

    //gets the default TimeZone

    DateTimeZone dateTimeZone= DateTimeZone.getDefault();

也许这篇文章可以帮助我删除DateTimeFormatter?首先打开一个新项目并运行该示例。如果成功了,按照你的意愿重构你的代码