chinmay.sahoo
New member
Code:
function getAmpm()
{
var now = new Date()
var hour = now.getHours()
if (hour >= 12)
return 11 // pm
/* else */
return 10 // am
}
The getAmpm() function returns 11 if the current time is P.M., and 10 if it is A.M. Notice that, since a return statement immediately terminates a function, the else keyword is not needed here and is commented out