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

16
LINES

< > BotCompany Repo | #1030677 // formatHoursMinutesColonSeconds - format a duration. hour is optional

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

Transpiled version (9572L) is out of date.

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 - format a duration. hour is optional
Eternal ID of this version: #1030677/4
Text MD5: 286c32d1a7a3cae5609a167add400364
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2024-08-18 18:54:08
Source code size: 438 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 200 / 288
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)