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

8
LINES

< > BotCompany Repo | #1036176 // formatHours

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

Transpiled version (127L) is out of date.

sS formatHours(long ms, int decimals default 1) {
  ret formatHours(toHours(ms), decimals);
}

sS formatHours(double hours, int decimals default 1) {
  S formatted = formatDouble(hours, decimals);
  ret eq(formatted, "1") ? "1 hour" : formatted + " hours";
}

Author comment

Began life as a copy of #1036175

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036176
Snippet name: formatHours
Eternal ID of this version: #1036176/2
Text MD5: 587941af40b503965e0cf30afa4a842c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-18 20:37:00
Source code size: 265 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 160 / 237
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1036234 - formatDays
#1036395 - formatHours_roundUp