Posts

Showing posts with the label typescript

How to add minutes in javascript date object

Image
  This code snippet you can use to add or subtract minute from JavaScript date object  function   addMinute ( date ,   min )   {      let   nD  =  new   Date ( date . getTime () +  min  *  6e4 )      return   nD ; } To add minutes call addMinute method and pass date param in which you want to add the minutes      let   date  =  new   Date () ;      addMinute ( date ,   5 ) To subtract the minute use this method as demonstrate below      let   date  =  new   Date () ;      addMinute ( date ,  - 5 ) Output: