Date plus minus JS, days group increased, date automatically modified

Source: Internet
Author: User

The most recent item in the train ticket, because the maximum range of train voting dates is 20 days, which is to control a date within 20 days of the current time

began to look for a direct modification of the Web date prototype later the leader said it was not so good, so we can only change another way to write

How to write, train of thought, Day + + turn month following year, good trouble

Viewed from the Internet is too hard to find, and then look at the time conversion

Or do you want to turn the current time into a time string, then add the current time string, get a new time string, a new time string, and convert it into a new time

Probably like the following code

functionAddday (d,s) {varm; varD =NewDate (d); D=d.valueof (); D= d + S * 24 * 60 * 60 * 1000; D=NewDate (d); M= D.getfullyear () + "-" + (D.getmonth () + 1) + "-" +d.getdate (); returnm;}varDate = "2014-8-28";varD = ' +date.split ('-') [0]+ '/' +date.split ('-') [1]+ '/' +date.split ('-') [2];d ocument.write (Addday (D,10))

Basically this is the case, because the need to pass the parameter D format (2014/08/28 or 2014,08,28) The second is not able to pass the first kind of regular conversion is not, can only be transferred once again as parameters passed in

Record it

It's convenient to find it next time.

Long time no angular JS will not forget, the weekend to study ah, with angular, many are lazy to write, now do not have to consider a variety of angular compatibility, crazy fill in

Fortunately there is a handlebar template, operation can be convenient, but there is time to study data binding, in order to write the project convenient point

Date plus minus JS, days group increased, date automatically modified

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.