如题,想按照周,查询日程信息。比如说:根据今天日期2010年4月16日,查处所在的本周的日程信息。点击“上一周”,就查询出上一周的日程;点击“下一周”,就查询出上一周的日程。

解决方案 »

  1.   

    获取本周的起始日期和结束日期是关键  js和sql都可处理出来
      

  2.   

    本周:date>=一周的第一天 and date <=一周的最后一天或是星期五
    这个还是比较简单的。Google能查到吧
      

  3.   

    搜索:数据库名+按周查询。比如:
    oracle 按周查询
      

  4.   

    //得到每周的第一天(周一)
    function getFirstDateOfWeek(){
    var theDate = new Date();
    var firstDateOfWeek;
    theDate.setDate(theDate.getDate() - theDate.getDay() + 1); //  
    firstDateOfWeek = theDate;
    return firstDateOfWeek;
    }
    //得到每周的最后一天(周日)
    function getLastDateOfWeek(){
    var theDate = new Date();
    var lastDateOfWeek;
    theDate.setDate(theDate.getDate() - theDate.getDay() + 1 + 6); //  
    lastDateOfWeek = theDate;
    return lastDateOfWeek;
    }
    //得到当前月的第一天
    function getFirstMonthDate(){
    var year = new Date().getFullYear();
        var month = new Date().getMonth();
        if (month<10){
            month = "0"+month;
        }
    var myDate = new Date(year,month,01);
    }
    //得到当前月的最后一天
    function getLastMonthDate(){
    var year = new Date().getFullYear();
    var month = new Date().getMonth()+1;
    var myDate = new Date(year,month,0);
    }太巧了 我刚写不久的 呵呵  上周的就用本周的再减去7天就可以了 
      

  5.   

    忘了怎么发布代码了,测试一个不对,那这个应该就是对的,不对的话将就看吧得到下一个星期的一周日期
    import java.text.SimpleDateFormat;
    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.GregorianCalendar;
    import java.util.List;
    public class Common 
    {
    private static final Common common = new Common();
    private Common()
    {

    }
    public static Common getCommon()
    {
    return common;
    }
    public Calendar getDate()
    {
     Calendar cal = new GregorianCalendar();
     cal.setTime(new Date());
     cal.add(Calendar.DAY_OF_WEEK, (9-cal.get(Calendar.DAY_OF_WEEK))%7);
     return cal;
    }

    public List getWeekDate()
    {
    List list = new ArrayList();
    Calendar cal = this.getDate();
    SimpleDateFormat d=new SimpleDateFormat("yyyy-MM-dd");
    for(int i=0;i<7;i++)
    {
    list.add(d.format(cal.getTime()));
    cal.roll(Calendar.DAY_OF_YEAR,true);

    }
    return list;

    }
    public static void main(String args[])
    {
    List list =  Common.getCommon().getWeekDate();
    for(int i=0;i<list.size();i++)
    {
    System.out.println(list.get(i));
    }
    }


    }