mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
change method name
This commit is contained in:
@@ -147,7 +147,7 @@ public class DateUtil extends CalendarUtil {
|
||||
*
|
||||
* @return 当前时间的标准形式字符串
|
||||
*/
|
||||
public static String now() {
|
||||
public static String formatNow() {
|
||||
return formatDateTime(new DateTime());
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class DateUtil extends CalendarUtil {
|
||||
*
|
||||
* @return 当前日期的标准形式字符串
|
||||
*/
|
||||
public static String today() {
|
||||
public static String formatToday() {
|
||||
return formatDate(new DateTime());
|
||||
}
|
||||
|
||||
@@ -804,7 +804,7 @@ public class DateUtil extends CalendarUtil {
|
||||
* @since 3.1.1
|
||||
*/
|
||||
public static DateTime parseTimeToday(CharSequence timeString) {
|
||||
timeString = StrUtil.format("{} {}", today(), timeString);
|
||||
timeString = StrUtil.format("{} {}", formatNow(), timeString);
|
||||
if (1 == StrUtil.count(timeString, ':')) {
|
||||
// 时间格式为 HH:mm
|
||||
return parse(timeString, DatePattern.NORM_DATETIME_MINUTE_PATTERN);
|
||||
|
@@ -1877,7 +1877,7 @@ public class CharSequenceUtil {
|
||||
* @return 截取后的字符串数组
|
||||
* @see StrSplitter#splitByLength(CharSequence, int)
|
||||
*/
|
||||
public static String[] split(CharSequence str, int len) {
|
||||
public static String[] splitToArray(CharSequence str, int len) {
|
||||
return StrSplitter.splitByLength(str, len);
|
||||
}
|
||||
|
||||
|
@@ -49,10 +49,10 @@ public class DateUtilTest {
|
||||
Assert.assertNotNull(date3);
|
||||
|
||||
// 当前日期字符串,格式:yyyy-MM-dd HH:mm:ss
|
||||
String now = DateUtil.now();
|
||||
String now = DateUtil.formatNow();
|
||||
Assert.assertNotNull(now);
|
||||
// 当前日期字符串,格式:yyyy-MM-dd
|
||||
String today = DateUtil.today();
|
||||
String today = DateUtil.formatToday();
|
||||
Assert.assertNotNull(today);
|
||||
}
|
||||
|
||||
|
@@ -27,10 +27,10 @@ public class ConcurrencyTesterTest {
|
||||
Console.log("开始执行第{}个",i);
|
||||
ct.test(() -> {
|
||||
// 需要并发测试的业务代码
|
||||
Console.log("当前执行线程:" + Thread.currentThread().getName()+" 产生时间 "+ DateUtil.now());
|
||||
Console.log("当前执行线程:" + Thread.currentThread().getName()+" 产生时间 "+ DateUtil.formatNow());
|
||||
ThreadUtil.sleep(RandomUtil.randomInt(1000, 3000));
|
||||
});
|
||||
}
|
||||
Console.log("全部线程执行完毕 "+DateUtil.now());
|
||||
Console.log("全部线程执行完毕 "+DateUtil.formatNow());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user