JSTL 날짜 포맷 <fmt:formatDate> <fmt:parseDate> 

fmt:parseDate - 문자열 -> Date 타입으로 변경

fmt:formatDate - Date 타입 -> 문자열으로 변경

 

1. JSTL <fmt:parseDate>

<fmt:parseDate var="date1" value="2019-01-01" pattern="yyyy-MM-dd"/> 
${date1}

 

결과값

Tue Jan 01 00:00:00 KST 2019

 

 

2. JSTL <fmt:formatDate>

<fmt:formatDate  var="date2" value="${date1}" type="DATE" pattern="yyyy-MM-dd"/>
${date2}

 

결과값

 2019-01-01

 

 

3. pattern 형식

y(The year) 

M(The month)

d(The day of the month)

h(The hour(12-hour time))

시(12)

H(The hour(24-hour time))

시(24)

m(The minute)

s(The second)

 

 

 

+ Recent posts