이 기사에서는 참조에 대한 DateUtil 도구 시간 스탬프 유형 변환에 대한 특정 코드를 공유합니다. 특정 내용은 다음과 같습니다
패키지 com.sinosoft.media.sms.util; import java.text.parseexception; import java.text.simpledateformat; import java.util.date; 공개 클래스 dateUtil {// 현재 시간 // 공개 정적 날짜 date_now = new Date (); / *** 완전한 타임 스탬프, 형식 : yyyymmdhhhmmsssss (연도, 월, 일, 시간, 시간, 두 번째, 밀리 초)* @return complete timestamp*/ public static string getfulltimestamp () {return new simpledateformat ( "yyyymmdddhhmmsssss"). } / *** 간단한 타임 스탬프, 형식 : yyyymmdd (연도, 월, 일)* @return simple timestamp* / public static string getSimpleTimestamp (return new simpledateformat). format (new Date ()); } / *** 지정된 형식* @param 패턴 지정된 형식* @return timestamp 지정된 형식* / public static string gettimestampbypattern (String Pattern) {return new simpledateformat (pattern) .format (new Date ()); } / *** 현재 날짜, 형식에 따라 형식으로 문자열을 얻습니다. } / *** 타임 스탬프, 형식 : yyyy-mm-dd hh : mm : ss (연도-월간 시간 : 분 : 초)* @return simple timestamp* / public static string getDateMestamp (날짜 날짜) {return new simpledateformat ( "yyyy-mm-dd hh : mm : ss"); } 공개 정적 날짜 getDateByString (String Str) {simpledateformat sim = new SimpledateFormat ( "yyyy-mm-dd hh : mm : ss"); 날짜 dateTime = null; try {dateTime = sim.parse (str); } catch (parseException e) {e.printstacktrace (); } return dateTime; }}위는이 기사의 모든 내용입니다. 모든 사람의 학습에 도움이되기를 바랍니다. 모든 사람이 wulin.com을 더 지원하기를 바랍니다.