+ 5
How to subtract minutes from minutes in javascript?
For example, I need to subtract 20 minus 30 minutes, but when subtracting it turns out minus 10, please help
5 odpowiedzi
+ 4
Get the value from `Date` object in milliseconds into a variable e.g. <ms> by using valueOf() method.
Then you subtract <ms> by number of milliseconds in 30 minutes. Note that there are 60000 milliseconds in a minute, so you multiply that by 30 (minutes).
Finally, create a new `Date` object from <ms>.
I think it will work, give it a try 👍
+ 9
Can you show your code? That helps people figure out what went wrong.
+ 6
Use moment.js in React
https://code.sololearn.com/W4x618SP3RZT/?ref=app
+ 5
Use moment.js subtract method
https://code.sololearn.com/W8S5M4mSTK57/?ref=app
+ 2
If there is a solution through jquery, then also write