public static void main(String[] args) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String dateFirst="2017-05-01"; String dateSecond="2017-05-25"; try{ Date st
declare @start date,@end date; set @start='2010-01-01'; set @end='2010-02-01'; --获取时间段内日期列表 select [day]=dateadd(day, number - 1, @start) from master.dbo.spt_values where type='P' and number <= datediff(day, @start,@end) + 1 and number>0
获取今天,昨天,上个月的日期 的方法: Calendar cal = Calendar.getInstance(); //获取今天的日期 cal.setTime(new Date()); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH)+1; int day = cal.get(Calendar.DAY_OF_MONTH); logger.debug(year + " 年 " + month +
import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; /** * Created by xiaochun on 2016/3/24. */ public class TimeUtil { public static void main(String[] args) { System.out.println("当前小时开始:"+getCurrentHourStartTime
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar c = Calendar.getInstance(); //过去七天 c.setTime(new Date()); c.add(Calendar.DATE, - 7); Date d = c.getTime(); String day = format.format(d); System.out.println("过去
select convert(varchar(7),dateadd(month,number,'2010-01-01'),120) AS MONTHfrom master..spt_valueswhere type='P' and dateadd(month,number,'2010-01-01')<='2010-09-01'
,'2015-01-01 00:00:00') h INTO vinson_h DELETE vinson_h DECLARE @h int SELECT @h=DATEDIFF(HOUR,'2015-01-01 00:00:00',GETDATE()) WHILE(@num<=@h) BEGIN INSERT INTO vinson_h(h) values (DATEADD(HOUR,@num,'2015-01-01 00:00:00')) END SELECT * FROM vinson_h
package test; import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date; public class Tesererew { public static void main(String[] args) { String [] arr=getBeforeSevenDay(); for (int i = 0; i < ar