Date
Java의 String에서 데이터 유형을 어떻게 만들 수 있습니까? 입력 : String "2014/01/01 18:02:02"
=> 출력 :Date 2014/01/01 18:02:02
DateFormat
to parse
및 format
(상호 함수) 를 사용할 수 있습니다 String
. 같은 것,
String str = "2014/01/01 18:02:02";
DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
try {
Date d = df.parse(str);
System.out.println(df.format(d));
} catch (ParseException e) {
e.printStackTrace();
}
출력은 (요청에 따라)
2014/01/01 18:02:02
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다