Convert Java / Spigot milliseconds to days, hours, minutes and seconds?

Pe
- in Plugins
1

Hi, I'm currently writing a plugin for Minecraft where you can check your online time on the server using the command. I save in the config via "System.currenttimemillis ();" the milliseconds when the player was jointed for the first time. Now I want you to be able to see how many seconds / minutes / hours / days that were. So the message would be like this: "Your first join was 2 hours 28 minutes and 40 seconds ago."

Now do it like this:

long longDate1 = System.currentTimeMillis () - configManager.getJoinFirst (player.getUniqueId ());
SimpleDateFormat formatter = new SimpleDateFormat ("DD 'day (s)' HH 'hour (s)' mm 'minute (s)' 'and' ss 'second (s)'");
player.sendMessage
(Strings.prefix + "§7You §7played §e"
+ formatter.format (longDate1) + "§7on this server.");

Can anyone help me further? It does not work that way. There's always a day and an hour too much.

ta