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

📄 test.java

📁 事件提醒系统
💻 JAVA
字号:
package com.myoa.cal.util;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test {
	
	public String StrToStrTime(String time){
		DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		DateFormat dateformat1 = new SimpleDateFormat("yyyy-M-d h:m:s");
		Date Udate = null;
		java.sql.Date Sdate = null;
		String date0 = null;
		try {
			Udate = dateformat1.parse(time);
			date0 = dateformat.format(Udate);
		}catch(Exception e){

		}
		return date0;		
	}
	
	
	public static void main(String[] args){
		DateUtil du = new DateUtil();
		Test tt = new Test();
		
//		Date d1 = du.StrToDate("2009-02-27 10:20:30");
//		Date d2 = du.StrToDate("2009-02-27 10:00:30");
//		long long1 = d1.getTime();
//		long space = 30 * 60 * 1000;
//		long result = long1 - space;
//		Date t_d = new Date(result);
//		
//		Timestamp ts2 = new Timestamp(d2.getTime());
//		Timestamp ts = new Timestamp(long1);
//		System.out.println(ts2.before(ts));
//		System.out.println(du.DateTimeToStr(t_d));
//		
		System.out.println(tt.StrToStrTime("2009-5-23 1:30:8"));
//		
	}

}

⌨️ 快捷键说明

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