javascript : Date.addMonths(number)

 

javascript : Date.addMonths(Number)


Target:

Applicable with Date Data Type.


Description :

Add/Subtract months from Date and return new Date object.



Syntax:

Date.addMonths(number)


Usase:

var dd = '1 Apr 2020'.toDateTime();
  1. dd.addMonths(1);
    It return "Fri May 01 2020 00:00:00 GMT+0530 (India Standard Time)"
  2. dd.addMonths(-1);
    It return "Sun Mar 01 2020 00:00:00 GMT+0530 (India Standard Time)"



Download MYJS.js

MyJs is a collection of java script extension methods that enhances the JavaScript objects, class object, DOM element, domElementsCollections, Date, String, Number and other data type. 

Include in you project landing page (master page) and it will extends your DOM and JavaScript Objects.

Comments

Popular posts from this blog

javascript : String.right

javascript : String.left

javascript : .nextAll()