mirror of
https://github.com/Estom/notes.git
synced 2026-02-06 20:14:37 +08:00
Java内容重新整理删除过期的东西
This commit is contained in:
32
Java/JavaDemo/codedemo/util/DateUtil.java
Normal file
32
Java/JavaDemo/codedemo/util/DateUtil.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package cn.aofeng.demo.util;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:aofengblog@163.com">聂勇</a>
|
||||
*/
|
||||
public class DateUtil {
|
||||
|
||||
/**
|
||||
* @return 返回当前时间的字符串(格式:"yyyy-MM-dd HH:mm:ss")
|
||||
*/
|
||||
public static String getCurrentTime() {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return dateFormat.format(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 下一分钟秒数为0的时间
|
||||
*/
|
||||
public static Date getNextMinute() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.MINUTE, 1);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
}
|
||||
18
Java/JavaDemo/codedemo/util/LogUtil.java
Normal file
18
Java/JavaDemo/codedemo/util/LogUtil.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package cn.aofeng.demo.util;
|
||||
|
||||
/**
|
||||
* 日志工具类。
|
||||
*
|
||||
* @author <a href="mailto:aofengblog@163.com">聂勇</a>
|
||||
*/
|
||||
public class LogUtil {
|
||||
|
||||
public static void log(String msg) {
|
||||
System.out.println(msg);
|
||||
}
|
||||
|
||||
public static void log(String msg, Object... param) {
|
||||
log( String.format(msg, param) );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user