My97 set the date for nearly 3 days

Source: Internet
Author: User

1. Referencing my97 js and CSS

2. Foreground code

<div class= "FormItem" >
<label>
Application Time </label>
<div class= "Formitemelement" >
<input type= "text" id= "txt_applydate" style= "width:200px; Cursor:pointer; "readonly=" readonly "class=" txt wdate "value=" <%=_date%> "
Onclick= "SetTime ();" required= "true"/>
</div>
</div>

3.js Code

<script language= "javascript" type= "Text/javascript" >
Set the time
function SetTime () {
Wdatepicker ({mindate: ' <%=_mindate%> ', maxdate: ' <%=_maxdate%> '})
}
</script>

4. Background code

public string _mindate = "";
public string _maxdate = "";
protected void Page_Load (object sender, EventArgs e)
{
if (DateTime.Now.DayOfWeek = = System.DayOfWeek.Monday)//Judge whether Monday
{
_maxdate = DateTime.Now.ToString ("Yyyy-mm-dd");
_mindate = DateTime.Now.AddDays (-3). ToString ("Yyyy-mm-dd");
}
else if (DateTime.Now.DayOfWeek = = System.DayOfWeek.Saturday)//Judging whether Saturday
{
_maxdate = DateTime.Now.ToString ("Yyyy-mm-dd");
_mindate = DateTime.Now.AddDays (-1). ToString ("Yyyy-mm-dd");
}
else if (DateTime.Now.DayOfWeek = = System.DayOfWeek.Sunday)//judge whether Sunday
{
_maxdate = DateTime.Now.ToString ("Yyyy-mm-dd");
_mindate = DateTime.Now.AddDays (-2). ToString ("Yyyy-mm-dd");
}
Else
{
_maxdate = DateTime.Now.ToString ("Yyyy-mm-dd");
_mindate = DateTime.Now.AddDays (-2). ToString ("Yyyy-mm-dd");
}
}

My97 set the date for nearly 3 days

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.