How do I increment a java.sql.Timestamp by 14 days?

后端 未结 4 2056
借酒劲吻你
借酒劲吻你 2020-12-09 08:47

I have an app that takes a Timestamp as a boundary for the start date and end date of a sql selection, I want to populate a hashmap with weeks this year since the first mon

4条回答
  •  天涯浪人
    2020-12-09 08:57

    It worth noting that 14 days is not always 14 * 24 * 3600 seconds. When you have daylight savings, this can be an hour shorter or longer. Historically it can be much more complex than that.

    Instead I would suggest using JodaTime or the Calendar to perform the time zone dependant calculation.

提交回复
热议问题