作者:华仔很忙 | 来源:互联网 | 2023-01-29 15:23
知识点:1.时间格式publicstaticSimpleDateFormatsdf3newSimpleDateFormat(yyyy-MM-dd);longnow
知识点:
1.时间格式
public static SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd");
long nowMills=System.currentTimeMillis();
String endTime=DataTool.sdf3.format(nowMills);
1.查询前10条记录,根据 字段 排序
select * from table where .... order by XX desc limit 0,10;
2.根据 时间日期 查询 :
注意时间格式必须是 2016-02-02
startTime="2016-02-02";
endTime="2016-03-04";
数据库中: birthdayDate 生日列名
String sql="select * from person where datetime(birthdayDate) between datetime('"
+startTime+"') and datetime('"+endTime+"')";
3.改-更新数据
String sql="update tableName set 列名 = '"
+ issue[7]+ "',lx = 'hf' where reportID = '"
+ issue[0]+ "' ";
4.增-新增数据
String sql="insert into qshf (reportID,reportTitle,reportContent,createTime,receiveContent,lx )values('"
+ issue[0]+ "','"
+ issue[1]+ "','"
+ issue[2]+ "','"
+ newFormatTime+ "','"
+ issue[7]
+ "','hf' )";
注意:sql="select * from qshf where createTime between '2017-02-10' and '2017-02-13'";
最佳