Created
October 8, 2016 02:39
-
-
Save liutf/40d7bb418cdfc09d5c41cb24696053a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.net263.util; | |
import java.sql.Timestamp; | |
import java.text.SimpleDateFormat; | |
import java.time.LocalDateTime; | |
import java.time.format.DateTimeFormatter; | |
import java.util.Date; | |
import static com.net263.constants.FoggConst.TIMES.PATTERN_YYYY_MM_DD_HHMMSS; | |
/** | |
* Created by liutf on 2016/4/25. | |
*/ | |
public class TimeUtil { | |
/** | |
* 获取当前系统时间 | |
* @return | |
*/ | |
public static Timestamp getSysTime(){ | |
SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYY_MM_DD_HHMMSS); | |
return Timestamp.valueOf(sdf.format(new Date())); | |
} | |
/** | |
* 获取当前时间 | |
* @return | |
*/ | |
public static String getFormatSysDateStr(){ | |
DateTimeFormatter format = DateTimeFormatter.ofPattern(PATTERN_YYYY_MM_DD_HHMMSS); | |
return LocalDateTime.now().format(format); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment