Timeline for How to add days to Date?
Current License: CC BY-SA 4.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 9, 2019 at 16:44 | review | Suggested edits | |||
| Oct 9, 2019 at 18:41 | |||||
| Nov 23, 2018 at 8:25 | history | edited | sbrbot | CC BY-SA 4.0 | added 11 characters in body |
| Jan 4, 2018 at 23:19 | comment | added | Alex Perrin | I have tried the method above and got strange results when adding 1000s of days. It gets solved by adding all the parameters of the Date constructor: Year, Month, Day,Hour, Minute,Second | |
| Apr 11, 2017 at 6:41 | comment | added | Jelle den Burger | I Agree, use this way. We just had a bug because of daylight saving time because we were using setDate. | |
| Jun 11, 2015 at 11:20 | comment | added | sbrbot | there is getMonth()+22 - what you think will it work!? | |
| Aug 23, 2014 at 8:57 | history | edited | sbrbot | CC BY-SA 3.0 | deleted 3 characters in body |
| Apr 1, 2014 at 23:01 | history | edited | sbrbot | CC BY-SA 3.0 | deleted 5 characters in body |
| Mar 14, 2014 at 12:33 | history | edited | sbrbot | CC BY-SA 3.0 | edited body |
| Mar 8, 2014 at 9:32 | history | edited | sbrbot | CC BY-SA 3.0 | added 79 characters in body |
| Nov 11, 2013 at 7:30 | comment | added | sbrbot | No Drew, it is usable for all days on year. You can put date offset bigger than 31 or month offset bigger than 12 and this function will recalculate it as day in next month or month in next year. So for example: nextday=new Date(oldDate.getFullYear(),oldDate.getMonth(),oldDate.getDate()+40); is perfectly well code. | |
| Oct 14, 2013 at 10:59 | comment | added | Drew Noakes | Doesn't work on the last day of any month, as you say. Makes this unusable on 12 days of the year. Sounds like a nightmare to debug!!! | |
| Mar 14, 2013 at 20:50 | history | edited | sbrbot | CC BY-SA 3.0 | deleted 48 characters in body |
| Feb 20, 2013 at 11:45 | comment | added | Álvaro González | Note: this resets time to 00:00:00 (can be an issue or not) | |
| Dec 3, 2012 at 23:55 | history | edited | sbrbot | CC BY-SA 3.0 | added 181 characters in body |
| Dec 3, 2012 at 23:42 | history | answered | sbrbot | CC BY-SA 3.0 |