日期 去时分秒 签到

###简单的做了个签到功能,需求签到时间需要时分,所以统计天数需要去时分,

<dependency>
  <groupId>joda-time</groupId>
  <artifactId>joda-time</artifactId>
  <version>2.10.13</version>
</dependency>

new LocalDate(signInTime).toDateTimeAtStartOfDay()去时分秒

final Map<String, Object> map = new HashMap<>(5);
map.put("last", Instant.ofEpochMilli(signInTime).toDateTime().toString("yyyy-MM-dd HH:mm"));//最新签到时间
final int days = Days.standardDaysIn(new Period(new LocalDate(signInTime).toDateTimeAtStartOfDay().getMillis(), new LocalDate().toDateTimeAtStartOfDay().getMillis())).getDays();
if (days <= 1) {
    map.put("today", days == 0);//今天是否已签到
    map.put("holding", this.countSignGroup(signGroup));//连续签到
//    map.put("signGroup", branchSignIn.getSignGroup());//连续标志
} else {
    map.put("absent", days -1);//未签到
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值