Revision 1e882dd7 snf-cyclades-app/synnefo/ui/static/snf/js/utils.js
b/snf-cyclades-app/synnefo/ui/static/snf/js/utils.js | ||
---|---|---|
132 | 132 |
|
133 | 133 |
// Util namespace |
134 | 134 |
synnefo.util = synnefo.util || {}; |
135 |
|
|
136 |
synnefo.util.FormatDigits = function(num, length) { |
|
137 |
var r = "" + num; |
|
138 |
while (r.length < length) { |
|
139 |
r = "0" + r; |
|
140 |
} |
|
141 |
return r; |
|
142 |
} |
|
143 |
|
|
144 |
synnefo.util.formatDate = function(d) { |
|
145 |
var dt = synnefo.util.FormatDigits(d.getDate()) + '/'; |
|
146 |
dt += synnefo.util.FormatDigits(d.getMonth(), 2); |
|
147 |
dt += '/' + d.getFullYear(); |
|
148 |
dt += ' ' + synnefo.util.FormatDigits(d.getHours(), 2) + ':'; |
|
149 |
dt += synnefo.util.FormatDigits(d.getMinutes(), 2) + ':'; |
|
150 |
dt += synnefo.util.FormatDigits(d.getSeconds(), 2); |
|
151 |
return dt; |
|
152 |
}, |
|
135 | 153 |
|
136 | 154 |
// Extensions and Utility functions |
137 | 155 |
synnefo.util.ISODateString = function(d){ |
Also available in: Unified diff