我正在使用日期sql,并且getDay()
返回此日期表示的星期几。返回值(0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday
)
//type of dateStart and dateEnd is java.sql.Date
//type of DateTime is joda.time.DateTime
public static Date[][] getListPeriod(Date dateStart , Date dateEnd){
DateTime start = new DateTime(dateStart.getYear()+1900,dateStart.getMonth()+1,dateStart.getDay(), 0, 0, 0, 0);
示例:日期值开始时间:2015-07-01
并且
dateStart.getDay()
返回2015-07-03(3 =星期三)我想
dateStart.getDay()
将此值设为1 最佳答案
使用new DateTime(dateStart.getTime())
怎么样?
要从java.sql.Date
获取(每月的)日期,必须使用getDate
。此方法继承自java.util.Date
并已弃用。从日期获取零件的正确方法是使用Calendar
。