增加nowDay方法
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -8,7 +8,7 @@
|
|||||||
<name>RedkaleProject</name>
|
<name>RedkaleProject</name>
|
||||||
<url>https://redkale.org</url>
|
<url>https://redkale.org</url>
|
||||||
<description>redkale -- java framework</description>
|
<description>redkale -- java framework</description>
|
||||||
<version>2.8.0-SNAPSHOT</version>
|
<version>2.8.1-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ public final class Times {
|
|||||||
|
|
||||||
private static final int ZONE_RAW_OFFSET = TimeZone.getDefault().getRawOffset();
|
private static final int ZONE_RAW_OFFSET = TimeZone.getDefault().getRawOffset();
|
||||||
|
|
||||||
|
static final String FORMAT_DAY = "%1$tY-%1$tm-%1$td"; // yyyy-MM-dd
|
||||||
|
|
||||||
static final String FORMAT_SECONDS = "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS"; // yyyy-MM-dd HH:mm:ss
|
static final String FORMAT_SECONDS = "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS"; // yyyy-MM-dd HH:mm:ss
|
||||||
|
|
||||||
static final String FORMAT_MILLS = "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL"; // yyyy-MM-dd HH:mm:ss.fff
|
static final String FORMAT_MILLS = "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL"; // yyyy-MM-dd HH:mm:ss.fff
|
||||||
@@ -47,6 +49,15 @@ public final class Times {
|
|||||||
return String.format(FORMAT_MILLS, System.currentTimeMillis());
|
return String.format(FORMAT_MILLS, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当天2015-01-01格式的string值
|
||||||
|
*
|
||||||
|
* @return 2015-01-01格式的string值
|
||||||
|
*/
|
||||||
|
public static String nowDay() {
|
||||||
|
return String.format(FORMAT_DAY, System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将指定时间格式化为 yyyy-MM-dd HH:mm:ss
|
* 将指定时间格式化为 yyyy-MM-dd HH:mm:ss
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user