1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
18 | var weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
19 |
|
20 |
|
21 | var DateHelper = function () {
|
22 | function DateHelper() {}
|
23 |
|
24 | var _proto = DateHelper.prototype;
|
25 |
|
26 | |
27 |
|
28 |
|
29 | _proto.getNowString = function getNowString() {
|
30 | var now = new Date();
|
31 | var weekDay = weekNames[now.getUTCDay()];
|
32 | var month = monthNames[now.getUTCMonth()];
|
33 | var day = now.getUTCDate();
|
34 | var hours = now.getUTCHours();
|
35 |
|
36 | if (hours < 10) {
|
37 | hours = "0" + hours;
|
38 | }
|
39 |
|
40 | var minutes = now.getUTCMinutes();
|
41 |
|
42 | if (minutes < 10) {
|
43 | minutes = "0" + minutes;
|
44 | }
|
45 |
|
46 | var seconds = now.getUTCSeconds();
|
47 |
|
48 | if (seconds < 10) {
|
49 | seconds = "0" + seconds;
|
50 | }
|
51 |
|
52 | var year = now.getUTCFullYear();
|
53 |
|
54 | var dateNow = weekDay + " " + month + " " + day + " " + hours + ":" + minutes + ":" + seconds + " UTC " + year;
|
55 | return dateNow;
|
56 | };
|
57 |
|
58 | return DateHelper;
|
59 | }();
|
60 |
|
61 | export { DateHelper as default }; |
\ | No newline at end of file |