| | |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | public static boolean isCanSellOneday(Date buyDate, int day) { |
| | | try{ |
| | | LocalDateTime buyTime = buyDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | LocalDateTime futureDate = buyTime.plusDays(day); |
| | | LocalDateTime zeroTime = futureDate.truncatedTo(ChronoUnit.DAYS); |
| | | Long buyDateTimes = Long.valueOf(zeroTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() / 1000L); |
| | | |
| | | Long nowDateTimes = Long.valueOf((new Date()).getTime() / 1000L); |
| | | |
| | | if (nowDateTimes.longValue() > buyDateTimes.longValue()) { |
| | | return false; |
| | | } |
| | | return true; |
| | | }catch (Exception e){ |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /*日期年月日是否相同*/ |
| | | public static boolean sameDate(Date d1, Date d2) { |
| | | SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); |