How do I fix an error? When I send a message, the date appears correctly, but when I receive a message, the date appears incorrectly. For example, 5 p.m., the date appears at 8 p.m. Here is a three-hour difference.
AdapterChat:
How do I fix an error? When I send a message, the date appears correctly, but when I receive a message, the date appears incorrectly. For example, 5 p.m., the date appears at 8 p.m. Here is a three-hour difference. AdapterChat: [code]Calendar cal = Calendar.getInstance(Locale.US); cal.setTimeInMillis(Long.parseLong(timeStamp)); String dateTime = DateFormat.format("dd/MM/yyyy hh:mm aa", cal).toString(); [/code] ChatActivity: [code]String timestamp = String.valueOf(System.currentTimeMillis()); [/code] [b]I tried changing Locale.US to Locale.getDefault, but the error was not fixed[/b] AdapterChat: [code]Calendar cal = Calendar.getInstance(Locale.getDefault()); cal.setTimeInMillis(Long.parseLong(timeStamp)); String dateTime = DateFormat.format("dd/MM/yyyy hh:mm aa", cal).toString(); [/code] ChatActivity: [code]String timestamp = String.valueOf(System.currentTimeMillis()); [/code]
Как исправить ошибку? Когда я отправляю сообщение, дата отображается правильно, но когда я получаю сообщение, дата отображается неправильно. Например, 17:00, дата появится в 20:00. Вот разница в три часа.
AdapterChat:
Calendar cal =...
Мне нужно проверить, как различные способы форматирования строк влияют на производительность. И я обнаружил удивительный результат. Позвольте мне объяснить на двух тестовых примерах:
// Test Case 2
for (int i = 0; i
использование ModestTree.Util;
с...