java獲取日期和時間

職業驅魔師發表於2013-08-06
public class BizManagerBL {
	public void addBiz(String bizId) {
		
	}

	public static void main(String[] args) {
		BizManagerBL bml=new BizManagerBL();
		System.out.println(bml.getDate());
	}
	private String getDate() {
		java.util.Calendar c = java.util.Calendar.getInstance();
		java.text.SimpleDateFormat f = new java.text.SimpleDateFormat(
				"yyyy:MM:dd");
		return f.format(c.getTime());
	}
	
	private String getTime(){
		java.util.Calendar c = java.util.Calendar.getInstance();
		java.text.SimpleDateFormat f = new java.text.SimpleDateFormat(
				"hh:MM:ss");
		return f.format(c.getTime());
	}
	

相關文章