java获取日期和时间

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());
	}
	

你可能感兴趣的:(java获取日期和时间)