Created
November 16, 2016 15:58
-
-
Save W3BGUY/8970caee26d1059bbbafb7375cfec557 to your computer and use it in GitHub Desktop.
NetSuite Get Number of Days in Month
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function to figure out the number of days in month. | |
function getDaysInMonth(thisMonth,thisYear){ | |
var monthArray=[31,28,31,30,31,30,31,31,30,31,30,31]; | |
if(thisMonth!=2){return monthArray[thisMonth-1]}; | |
if(thisYear%4!=0){return monthArray[1]}; | |
if(thisYear%100==0 && thisYear%400!=0){return monthArray[1]}; | |
return monthArray[1]+1; | |
} | |
// NetSuite usage example | |
nlapiLogExecution('DEBUG',getDaysInMonth(11,2016)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment