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

12
LINES

< > BotCompany Repo | #1036234 // formatDays

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

Libraryless. Click here for Pure Java version (145L/1K).

sS formatDays(Duration d, int decimals default 1) {
  ret formatDays(toMS(d), decimals);
}

sS formatDays(long ms, int decimals default 1) {
  ret formatDays(toDays(ms), decimals);
}
  
sS formatDays(double days, int decimals default 1) {
  S formatted = formatDouble(days, decimals);
  ret eq(formatted, "1") ? "1 day" : formatted + " days";
}

Author comment

Began life as a copy of #1036176

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036234
Snippet name: formatDays
Eternal ID of this version: #1036234/5
Text MD5: 7474a1bbd110b1cbf47f8041faa147f4
Transpilation MD5: 5cd37d58dc8a78e9a9337c24a08ddadc
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:45:46
Source code size: 355 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 70 / 112
Version history: 4 change(s)
Referenced in: [show references]