Skip to content

Commit c83e693

Browse files
committed
see 12/07 log
1 parent dc3bed8 commit c83e693

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

utilcode/src/main/java/com/blankj/utilcode/utils/TimeUtils.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ public static String getFriendlyTimeSpanByNow(Date date) {
716716
public static String getFriendlyTimeSpanByNow(long millis) {
717717
long now = System.currentTimeMillis();
718718
long span = now - millis;
719-
if (span < 0) return String.format("%tc", new Date(millis));
719+
if (span < 0)
720+
return String.format("%tc", millis);// U can read http://www.apihome.cn/api/java/Formatter.html to understand it.
720721
if (span < 1000) {
721722
return "刚刚";
722723
} else if (span < ConstUtils.MIN) {
@@ -727,11 +728,11 @@ public static String getFriendlyTimeSpanByNow(long millis) {
727728
// 获取当天00:00
728729
long wee = (now / ConstUtils.DAY) * ConstUtils.DAY;
729730
if (millis >= wee) {
730-
return String.format("今天%tR", new Date(millis));
731+
return String.format("今天%tR", millis);
731732
} else if (millis >= wee - ConstUtils.DAY) {
732-
return String.format("昨天%tR", new Date(millis));
733+
return String.format("昨天%tR", millis);
733734
} else {
734-
return String.format("%tF", new Date(millis));
735+
return String.format("%tF", millis);
735736
}
736737
}
737738

@@ -1082,8 +1083,8 @@ public static String getChineseZodiac(int year) {
10821083
return CHINESE_ZODIAC[year % 12];
10831084
}
10841085

1085-
private static final String[] ZODIAC = {"水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "魔羯座"};
1086-
private static final int[] ZODIAC_FLAGS = {20, 19, 21, 21, 21, 22, 23, 23, 23, 24, 23, 22};
1086+
private static final String[] ZODIAC = {"水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "魔羯座"};
1087+
private static final int[] ZODIAC_FLAGS = {20, 19, 21, 21, 21, 22, 23, 23, 23, 24, 23, 22};
10871088

10881089
/**
10891090
* 获取星座

0 commit comments

Comments
 (0)