Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getPlainEnglishTimefromDays(daysValue:Number):String {
- var text:String = "";
- var days:Number = Math.abs(daysValue);
- if (days < 1) {
- var hours:Number = days * 24;
- if (hours < 1) {
- var minutes:int = Math.floor(hours * 60);
- text = minutes + " minute";
- if (minutes != 1) {
- text += "s";
- }
- } else {
- text = Math.floor(hours) + " hour";
- if (Math.floor(hours) != 1) {
- text += "s";
- }
- }
- } else if (days > 0) {
- text = Math.floor(days) + " day";
- if (Math.floor(days) != 1) {
- text += "s";
- }
- }
- return text;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement