Get Twelve Hours from Date - Node.js Date

Node.js examples for Date:Hour

Description

Get Twelve Hours from Date

Demo Code


Date.prototype.getTwelveHours = function() {
    hours = this.getHours();//from   w w  w  .  j  ava2  s  .c  o m
    if (hours == 0) {
        return 12;
    }
    else {
        return hours <= 12 ? hours : hours-12
    }
}

Related Tutorials