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).

1  
sS formatDays(Duration d, int decimals default 1) {
2  
  ret formatDays(toMS(d), decimals);
3  
}
4  
5  
sS formatDays(long ms, int decimals default 1) {
6  
  ret formatDays(toDays(ms), decimals);
7  
}
8  
  
9  
sS formatDays(double days, int decimals default 1) {
10  
  S formatted = formatDouble(days, decimals);
11  
  ret eq(formatted, "1") ? "1 day" : formatted + " days";
12  
}

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: 147 / 230
Version history: 4 change(s)
Referenced in: [show references]