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

📄 datewrapper.java

📁 一个搜索引擎,希望对大家有用
💻 JAVA
字号:
package test;

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

public class DateWrapper {
	
	private String format = null;

	private Date date = null;

	private SimpleDateFormat sf = null;

	public DateWrapper() throws Exception {
	}

	public String output(String format) {
		date = new Date();
		sf = new SimpleDateFormat(format);
		return sf.format(date);
	}
	
	public static void main (String [] args) throws Exception{
		DateWrapper wrapper = new DateWrapper();
		System.out.println("yyyy-MM-dd : " + wrapper.output("yyyy-MM-dd"));
		System.out.println("yyyy-MM-dd hh:mm:ss : " + wrapper.output("yyyy-MM-dd hh:mm:ss"));
	}

	public String getFormat() {
		return format;
	}

}

⌨️ 快捷键说明

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