50 xhr.send(); |
50 xhr.send(); |
51 }; |
51 }; |
52 |
52 |
53 function timeConverter(UNIX_timestamp) |
53 function timeConverter(UNIX_timestamp) |
54 { |
54 { |
|
55 const d = new Date(); |
|
56 const now = (d.getTime() + d.getTimezoneOffset()) / 1000; |
55 var a = new Date(UNIX_timestamp * 1000); |
57 var a = new Date(UNIX_timestamp * 1000); |
56 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; |
58 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; |
|
59 var weekdays = ['Su', 'Mo', 'Tu', 'Wed', 'Th', 'Fr', 'Sa']; |
57 var year = a.getFullYear(); |
60 var year = a.getFullYear(); |
58 var month = months[a.getMonth()]; |
61 var month = months[a.getMonth()]; |
59 var date = a.getDate(); |
62 var date = a.getDate(); |
60 var hour = a.getHours(); |
63 var hour = a.getHours(); |
61 var min = a.getMinutes(); |
64 var min = a.getMinutes(); |
62 var sec = a.getSeconds(); |
65 var sec = a.getSeconds(); |
63 var time = hour + ':' + (min < 10 ? '0' : '') + min; |
66 var time = ''; |
|
67 |
|
68 if (date != d.getDate()) |
|
69 { |
|
70 if (UNIX_timestamp - 7 * 24 * 60 * 60 < now) |
|
71 time = weekdays[a.getDay()] + ' '; |
|
72 else |
|
73 time = '' + date + '.' + (a.getMonth() + 1) + '. '; |
|
74 } |
|
75 time += hour + ':' + (min < 10 ? '0' : '') + min; |
64 return time; |
76 return time; |
65 } |
77 } |
66 |
78 |
67 function epoch() |
79 function epoch() |
68 { |
80 { |