标签:for cal pre turn final mil 日期加减 nal orm
JavaScript: function addDate(date, days) { //格式:addDate(‘2017-1-11‘, -20) var d = new Date(Date.parse(date.replace(/-/g, "/")));//兼容性处理 d.setDate(d.getDate() + days); var m = d.getMonth() + 1; var res = d.getFullYear() + ‘/‘ + m + ‘/‘ + d.getDate(); return new Date(res).Format(‘yyyy-MM-dd‘); } java: private Date add(Date date, int amount) { if (date == null) { final Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.DAY_OF_MONTH, amount); return c.getTime(); } return date; } addYears Calendar.YEAR addMonths Calendar.MONTH addWeeks Calendar.WEEK_OF_YEAR addDays Calendar.DAY_OF_MONTH addHours Calendar.HOUR_OF_DAY addMinutes Calendar.MINUTE addSeconds Calendar.SECOND addMilliseconds Calendar.MILLISECOND
标签:for cal pre turn final mil 日期加减 nal orm
原文地址:https://www.cnblogs.com/hahajava/p/9044659.html