java中的当前时间减去天数

2024-11-24 18:01:18
推荐回答(2个)
回答1:

java.util.Calendar

voidsetTime(Date date)

Sets this Calendar's time with the given Date.
设置日期时间

abstract void add(int field, int amount)

Adds or subtracts the specified amount of time to the given calendar field,
based on the calendar's rules.
参数1是 Calendar.DAY_OF_MONTH
参数2是天数,如果是负数,则为减

DategetTime()

Returns a Date object representing this
Calendar's time value (millisecond offset from the Epoch").
再得到时间

回答2:

没理解你的强制回收天数
是要记录你减去的天数那个数据吗