JS get the latest week date, day of the week method

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags .net ajax content date document get html http

<html>

<head>

<meta http-equiv= "Content-type" content= "textml; Charset=utf-8 ">

<title>js Get Date: Day before yesterday, today, tomorrow, day after-liehuo.net</title>

</head>

<body>

<script language= "JavaScript" type= "Text/javascript" >

function Getdatestr (adddaycount) {

var dd = new Date ();

Dd.setdate (Dd.getdate () +adddaycount);//Get Adddaycount Day

var y = dd.getfullyear ();

var m = dd.getmonth () +1;//Gets the date of the current month

var d = dd.getdate ();

var a = new Array ("Sunday", "Monday", Tuesday "," Wednesday "," Thursday "," Friday "," Saturday "," Sunday "," Monday "," Tuesday "," Wednesday "," Thursday "," Friday "," Saturday "," Sunday ");

var week = new Date (). Getday () +adddaycount;

var w = A[week];

return m+ "month" +d+ "Day" wheels;

}

document.write ("The day Before:" +getdatestr (-2));

document.write ("<br/> Yesterday:" +getdatestr (-1));

document.write ("<br/> Today:" +getdatestr (0));

document.write ("<br/> Tomorrow:" +getdatestr (1));

document.write ("<br/> Day After Tomorrow:" +getdatestr (2));

document.write ("<br/> The day After Tomorrow:" +getdatestr (3));

document.write ("<br/> Day After Tomorrow:" +getdatestr (4));

document.write ("<br/> The day After Tomorrow:" +getdatestr (5));

document.write ("<br/> Day After Tomorrow:" +getdatestr (6));

document.write ("<br/> The day After Tomorrow:" +getdatestr (7));

</script>

</body>

<ml>

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.