Java Code Examples for cn.hutool.core.date.DateUtil#formatDateTime()
The following examples show how to use
cn.hutool.core.date.DateUtil#formatDateTime() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UseHutool.java From java-tutorial with MIT License | 6 votes |
/** * hutool 时间格式化 */ public static void dateFormat() { String dateStr = "2017-03-01"; Date date = DateUtil.parse(dateStr); //结果 2017/03/01 String format = DateUtil.format(date, "yyyy/MM/dd"); //常用格式的格式化,结果:2017-03-01 String formatDate = DateUtil.formatDate(date); //结果:2017-03-01 00:00:00 String formatDateTime = DateUtil.formatDateTime(date); //结果:00:00:00 String formatTime = DateUtil.formatTime(date); System.out.println(format); System.out.println(formatDate); System.out.println(formatDateTime); System.out.println(formatTime); }
Example 2
Source File: Jvm.java From spring-boot-demo with MIT License | 4 votes |
public String getStartTime() { return DateUtil.formatDateTime(new Date(ManagementFactory.getRuntimeMXBean() .getStartTime())); }
Example 3
Source File: Jvm.java From spring-boot-demo with MIT License | 4 votes |
public String getStartTime() { return DateUtil.formatDateTime(new Date(ManagementFactory.getRuntimeMXBean() .getStartTime())); }
Example 4
Source File: JvmInfo.java From Guns with GNU Lesser General Public License v3.0 | 4 votes |
/** * JDK启动时间 */ public String getStartTime() { long time = ManagementFactory.getRuntimeMXBean().getStartTime(); Date date = new Date(time); return DateUtil.formatDateTime(date); }
Example 5
Source File: Jvm.java From spring-boot-demo with MIT License | 4 votes |
public String getStartTime() { return DateUtil.formatDateTime(new Date(ManagementFactory.getRuntimeMXBean() .getStartTime())); }