How to increment time by 1 hour

后端 未结 3 1212
生来不讨喜
生来不讨喜 2020-12-20 15:18

I have two time values. one for the previous login time and one for the current login time. I have to increase previous time login by one hour. I have used the date format

3条回答
  •  粉色の甜心
    2020-12-20 16:05

       Calendar calendar = Calendar.getInstance();
       calendar.setTime(previous_time);
       calendar.add(Calendar.HOUR, 1);
       previous_time = calendar.getTime();
       // do your comparison
    

提交回复
热议问题