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
相关文档:
1 :普通SQL语句可以用Exec执行
例: Select * from tableName
Exec('select * from tableName')
& ......
建表:
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 [ ......
==============================================
第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 ......
==============================================
第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 ......