时间日期处理

1:String格式转Timestamp格式

	public Timestamp switchStringToTimestamp(String time){
		//SimpleDateFormat sDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Timestamp eventTime_pre = TimeStampUtil.getCurrentTimestamp();
        try {  
        	eventTime_pre = Timestamp.valueOf(time);  
        } catch (Exception e) {  
            e.printStackTrace();  
            log.info("StringTime switch to  Timestamp failed");
        } 
        
        return eventTime_pre;
	}

 

 

你可能感兴趣的:(JAVA)