Files
purple-explorer/views/includes/common.pug
T

51 lines
1.7 KiB
Plaintext
Raw Normal View History

script.
function format_unixtime(unixtime, skipIncrease) {
skipIncrease = skipIncrease || false;
var a = new Date(unixtime*(skipIncrease ? 1 : 1000));
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var year = a.getFullYear();
var month = months[a.getMonth()];
var date = a.getDate();
var hour = a.getHours();
var min = a.getMinutes();
var sec = a.getSeconds();
var suffix = 'th';
if (date == 1 || date == 21 || date == 31)
suffix = 'st';
if (date == 2 || date == 22 || date == 32)
suffix = 'nd';
if (date == 3 || date == 23)
suffix = 'rd';
if (hour < 10)
hour = '0' + hour;
if (min < 10)
min = '0' + min;
if (sec < 10)
sec = '0' + sec;
return date + suffix + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec + ' GMT';
};
- function format_unixtime(unixtime, skipIncrease) {
- skipIncrease = skipIncrease || false;
- var a = new Date(unixtime*(skipIncrease ? 1 : 1000));
- var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
- var year = a.getFullYear();
- var month = months[a.getMonth()];
- var date = a.getDate();
- var hour = a.getHours();
- var min = a.getMinutes();
- var sec = a.getSeconds();
- var suffix = 'th';
if date == 1 || date == 21 || date == 31
- suffix = 'st';
if date == 2 || date == 22 || date == 32
- suffix = 'nd';
if date == 3 || date == 23
- suffix = 'rd';
if hour < 10
- hour = '0' + hour;
if min < 10
- min = '0' + min;
if sec < 10
- sec = '0' + sec;
- return date + suffix + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec + ' GMT';
- };