Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1030677 // formatHoursMinutesColonSeconds - hour is optional

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9572L/52K).

sS formatHoursMinutesColonSeconds(double seconds) {
  ret formatHoursMinutesColonSeconds(toMS(seconds));
}

sS formatHoursMinutesColonSeconds(long ms) {
  long seconds = iround(toSeconds(ms));
  long hours = seconds/(60*60);
  S s = "";
  if (hours > 0) {
    s = hours + ":";
    seconds -= hours*60*60;
    s += formatInt(seconds/60, 2);
  } else
    s = str(seconds/60);
  ret s + ":" + formatInt(mod(seconds, 60), 2);
}

Author comment

Began life as a copy of #1020551

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030677
Snippet name: formatHoursMinutesColonSeconds - hour is optional
Eternal ID of this version: #1030677/3
Text MD5: 286c32d1a7a3cae5609a167add400364
Transpilation MD5: 846ae906f2d13989aabd95c4d021087d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-04 20:39:56
Source code size: 438 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 119 / 179
Version history: 2 change(s)
Referenced in: [show references]