0

Hi I need to display the timestamp but i didn't get the proper output here is my coding can you check my code and correct my mistakes.My code displays only UTC time not device time.

// 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));

Please check this I need a timestamp like this: image link

4

1 回答 1

0

我认为你从来没有设置过时区。先设置时区然后运行希望它对你有用。

    //gets the default TimeZone

    DateTimeZone dateTimeZone= DateTimeZone.getDefault();
于 2013-12-20T03:54:38.843 回答