Skip to content

Commit bfbbfe4

Browse files
committedAug 15, 2013
Backport some additional Time#strftime() replacers
1 parent 9491bad commit bfbbfe4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎corelib/time.rb

+6
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,14 @@ def strftime(format = '')
107107
case 'A': return days_of_week[d.getDay()];
108108
case 'b': return short_months[d.getMonth()];
109109
case 'B': return long_months[d.getMonth()];
110+
case 'm':
111+
var month = d.getMonth() + 1;
112+
return month < 10 ? '0' + month : month;
113+
case 'd': return (d.getDate() < 10 ? '0' + d.getDate() : d.getDate());
110114
case '-d': return d.getDate();
111115
case 'Y': return d.getFullYear();
116+
case 'H': return d.getHours();
117+
case 'M': return d.getMinutes();
112118
default: return m ;
113119
}
114120
});

0 commit comments

Comments
 (0)
Please sign in to comment.