[JS] Return Month in Text, Rather Than in Numbers

Status
Not open for further replies.

brsy

nah mang
May 12, 2011
1,530
272
Can someone make my month value return the month in words, rather than in numbers? This is for a lock screen widget for iOS 8.


 
I found the solution:
PHP:
function clock(t) {
    var month = new Array();
    month[0] = "January";
    month[1] = "February";
    month[2] = "March";
    month[3] = "April";
    month[4] = "May";
    month[5] = "June";
    month[6] = "July";
    month[7] = "August";
    month[8] = "September";
    month[9] = "October";
    month[10] = "November";
    month[11] = "December";

    var e = function() {
        var n = new Date,
            u = {
                hour: function() {
                    var e = t.twentyfour === !0 ? n.getHours() : (n.getHours() + 11) % 12 + 1;
                    return e = 10 > e ? "0" + e : " " + e
                },
                minute: function() {
                    return n.getMinutes() < 10 ? "0" + n.getMinutes() : n.getMinutes()
                },
                second: function() {
                    return n.getSeconds() < 10 ? "0" + n.getSeconds() : n.getSeconds()
                },
                date: function() {
                    return n.getDate() < 10 ? "0" + n.getDate() : n.getDate()
                },
                month: function() {
                    return month[n.getMonth()] < 10 ? "0" + month[n.getMonth()] : month[n.getMonth()]
                },
                year: function() {
                    return n.getFullYear() < 10 ? "0" + n.getFullYear() : n.getFullYear()
                }
            };
        t.success(u), setTimeout(function() {
            e()
        }, t.refresh)
    };
    e()
}
 
Status
Not open for further replies.

Users who are viewing this thread

Top