最近公司要我做ASP可是我不什么懂.现在遇到一个请大虾帮忙一下:
在ASP中如何取本月的最后一天,如我要选择条件2006年11月BeginDate= Request("Year") & "-" &Request("Month") & "-" & "01":起始日期BeginDate???????:结束日期改什么写
因为后台的过程SQL过滤条件为:    BeginDate<=DATE<=BeginDate

解决方案 »

  1.   

    http://topic.csdn.net/t/20010817/08/242652.html
    看看这个会对你有帮助 
    到asp版面问问
      

  2.   

    由于每个月的天数是不一样的,因此每个月最后一天的日期也不固定的,因此本函数通过循环,判断是否出现新的月份,来确定该月的最后一日的日期. Public Function MonLastDay(dFirst As Date) As Date
        Dim dm As Date
        Dim m As Integer
        
        dm = dFirst
        m = Month(dm)
        Do While Month(dm) = m
           dm = dm + 1
        Loop
        MonLastDay = dm - 1
    End Function 
    下面是由ACCESS中国的李啸林版主提供:Public Function MonLastDay1(dFirst As Date) As Date
       MonLastDay1 = DateAdd("d", -1, CDate(DatePart("yyyy", DateAdd("m", 1, dFirst)) & _
                     "-" & DatePart("m", DateAdd("m", 1, dFirst))))
    End Function 
    下面是由ACCESS中国的AlexLiu提供:Public Function MonLastDay1(dFirst As Date) As Date
       MonLastDay1 = DateSerial(Year(dFirst), Month(dFirst) + 1, 1) - 1 
    End Function 转自网络,没有验证。
    接分
      

  3.   

    private string GetLastDay()
    {
    int iYear  = DateTime.Now.Year;
    //得到此月的月份信息;
    int iMonth = DateTime.Now.Month;
    //得到此月的天数信息;
    int daysOfMonth = DateTime.DaysInMonth(iYear,iMonth);
    //得到当月的最后一天;
    string endDate   =  Convert.ToString(iYear) +"-"+ Convert.ToString(iMonth)+"-"+ Convert.ToString(daysOfMonth);
    return endDate;
    }