diff options
author | Mavlushechka <mavlushechka@gmail.com> | 2022-01-30 18:44:01 +0500 |
---|---|---|
committer | Mavlushechka <mavlushechka@gmail.com> | 2022-01-30 18:44:01 +0500 |
commit | f8f0a605ca3bdf647d908eb58eb45943527bad73 (patch) | |
tree | 24b98412431e60d7f7ff7100f352ff8287495d86 /src | |
parent | 728c792aabb93a6a6ac5e8d8088f4adf920a4309 (diff) |
Added imports Date and TimeZone
Diffstat (limited to 'src')
-rwxr-xr-x | src/main/java/com/mavlushechka/animarfo/telegram/bot/Bot.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/mavlushechka/animarfo/telegram/bot/Bot.java b/src/main/java/com/mavlushechka/animarfo/telegram/bot/Bot.java index 6014055..185b014 100755 --- a/src/main/java/com/mavlushechka/animarfo/telegram/bot/Bot.java +++ b/src/main/java/com/mavlushechka/animarfo/telegram/bot/Bot.java @@ -16,6 +16,8 @@ import com.pengrad.telegrambot.request.SendPhoto; import java.io.IOException; import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; import java.util.logging.Level; import java.util.logging.Logger; @@ -42,10 +44,11 @@ public class Bot { } if (update.message() != null) { User user = update.message().from(); - SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat("dd.MM.yyyy HH:mm:ss z"); - simpleDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT+5")); - String formattedDate = simpleDateFormat.format(new java.util.Date(update.message().date() * 1000L)); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss z"); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+5")); + String formattedDate = simpleDateFormat.format(new Date(update.message().date() * 1000L)); telegramUser = new TelegramUser(user.id(), user.isBot(), user.firstName(), user.lastName(), user.username(), formattedDate); + try { UserMessage.execute(update.message()); } catch (IOException ioException) { |