fix:
update:修改获取健康码
This commit is contained in:
2022-09-05 11:49:28 +08:00
parent e5b3385346
commit 04a842e3d7
13 changed files with 370 additions and 63 deletions

View File

@@ -0,0 +1,29 @@
package com.uiui.aios.utils;
import android.os.Build;
import androidx.annotation.RequiresApi;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
public class TimeUtils {
@RequiresApi(api = Build.VERSION_CODES.O)
public static boolean isTodayTime(long timeStamp) {
String time = transferLongToDate(timeStamp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime localTime = LocalDateTime.parse(time, dtf);
LocalDateTime startTime = LocalDate.now().atTime(0, 0, 0);
LocalDateTime endTime = LocalDate.now().atTime(23, 59, 59);
return localTime.isAfter(startTime) && localTime.isBefore(endTime);
}
public static String transferLongToDate(Long millSec) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date(millSec);
return sdf.format(date);
}
}