易截截图软件、单文件、免安装、纯绿色、仅160KB

java时间函数,以及 sql 时间范围查找 代码

 String keyword = request.getParameter("keyword");
   String timeRange = request.getParameter("timeRange");
   String type = request.getParameter("type");
  
   StringBuffer sql = new StringBuffer();
   sql.append("use webstation_leadall select f.id,f.title,f.publishtime from information f left join infotype t on f.typeid=t.id  where ");
   if( (keyword == null)|| (keyword.equals("")) ){  
   sql.append("title like '%' and ");
  }else {
   sql.append("title like '%"+keyword +"%' and ");
  }
  
  if(timeRange.equals("")||timeRange==null){
   sql.append("");
  }else{
   //Calendar cal = Calendar.getInstance();
   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");
      //String now = sdf.format(cal.getTime());
   String begintime = "";
   String endtime = "";
   java.util.Date myDate=new java.util.Date();
   long myTime = 0;
   if(timeRange.equals("1")){
    myTime=((myDate.getTime()/1000)-60*60*24)*1000;
    begintime = sdf.format(new   java.util.Date(myTime));
    endtime = sdf.format(myDate);
    //System.out.println("------"+begintime+"+++++"+endtime);
   }else if(timeRange.equals("3")){
    myTime=((myDate.getTime()/1000)-60*60*24*3)*1000;
    begintime = sdf.format(new   java.util.Date(myTime));
    endtime = sdf.format(myDate);
    //System.out.println("------"+begintime+"+++++"+endtime);
   }else if(timeRange.equals("7")){
    myTime=((myDate.getTime()/1000)-60*60*24*7)*1000;
 &n


相关文档:

动态sql语句基本语法

1 :普通SQL语句可以用Exec执行
      例:      Select * from tableName
                Exec('select * from tableName')
        & ......

SQL Server 语句查询手册

建表:
CREATE TABLE  [DB.dbo].tableName
(Stud_id int CONSTRAINT  constraintName1  not null primary key,
 Name nvarchar(5) not null,
 Birthday datetime,
 Gender nchar(1),
 Telcode char(12),
 Zipcode char(6) CONSTRAINT constraintName2 CHECK(zipcode like [ ......

小布作品:SQL*Plus使用培训 (全8讲)

==============================================
 
第1讲
在线观看: http://www.boobooke.com/v/bbk1389
视频下载: http://www.boobooke.com/v/bbk1389.zip
 
第2讲
在线观看: http://www.boobooke.com/v/bbk1390
视频下载: http://www.boobooke.com/v/bbk1390.zip
 
第3讲
在线观看: http ......

小布作品:Oracle 11g SQL基础入门系列培训(全30讲)

==============================================
 
第01讲: Chapter 00--Oracle 11g SQL Fundamentals Training Introduction
在线观看: http://www.boobooke.com/v/bbk2003
视频下载: http://www.boobooke.com/v/bbk2003.zip
 
第02讲: Chapter 00--Oracle 11g SQL Fundamentals Training Introduction ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号