⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datetimehelper.java

📁 中应用程序的访问权限对Java Web Console 中应用程序的访问权限 成功登录 Web 控制台后,可能无法自动访问在该控制台中注册的所有应用程序。通常,必须安装应用程序,才能让所有的用户在控制
💻 JAVA
字号:
package edu.yinhe.mis.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 张崇杰
 *
 */
public class DateTimeHelper {

		private static SimpleDateFormat FULL_SDF = new SimpleDateFormat(
				"yyyy-MM-dd HH:mm:ss");

		private static SimpleDateFormat DFULL_SDF = new SimpleDateFormat(
				"yyyy-MM-dd");

		private static SimpleDateFormat DFULL_SDF_SLASH = new SimpleDateFormat(
				"yyyy/MM/dd HH:mm");

		private static SimpleDateFormat FULL_SDF_NOSP = new SimpleDateFormat(
				"yyyyMMddHHmm");

		private static SimpleDateFormat DFULL_SDF_CN = new SimpleDateFormat(
				"yyyy年MM月dd日");

		private static SimpleDateFormat ONLY_TIME = new SimpleDateFormat("HH:mm");

		private static SimpleDateFormat MD_TIME = new SimpleDateFormat("MM-dd");

		public static String getMDTime(Date date) {
			if (date != null) {
				return MD_TIME.format(date);
			} else {
				return "";
			}

		}

		public static String getOnlyTime(Date date) {
			if (date != null) {
				return ONLY_TIME.format(date);
			} else {
				return "";
			}

		}

		public static String getFullTimeNoSP(Date date) {
			if (date != null) {
				return FULL_SDF_NOSP.format(date);
			} else {
				return "";
			}

		}

		public static String getFullTimeTwo(Date date) {
			if (date != null) {
				String dateStr = FULL_SDF.format(date);
				return dateStr.substring(2, 10);
			} else {
				return "";
			}

		}

		public static String getFullTime(Date date) {
			if (date != null) {
				return FULL_SDF.format(date);
			} else {
				return "";
			}
		}

		public static String getDFullTime(Date date) {
			if (date != null) {
				return DFULL_SDF.format(date);
			} else {
				return "";
			}
		}

		public static String getDFullTimeSlash(Date date) {
			if (date != null) {
				return DFULL_SDF_SLASH.format(date);
			} else {
				return "";
			}
		}

		public static String getDFullTimeCN(Date date) {
			if (date != null) {
				return DFULL_SDF_CN.format(date);
			} else {
				return "";
			}
		}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -