Monday, December 11, 2017

Get end day of the month ( jquery / javascript)


This is a simple workout to find the end day of the month for selected date in javascript. Below is the workout on how you can do it.

Lets suppose for May 2017, you want to find the end of the month. On you javascript code you can write the following.

var _Year = 2017;
var _Month = 5;
var _date = (new Date(_Year, _Month, 0, 0, 0, 0));
var endOfMonth = _date.getDate();

endOfMonth is the end day of the month for given year and given month. You can change the year and month yourself or make it dynamic based on arguments by creating a function.

For end of month in sql check the link : http://iamfixed.blogspot.com/2017/11/get-end-of-month-in-mssql-2008-r2-2012.html

No comments:

Post a Comment