%@page import="java.util.Date"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
${time }
<% String[] zone = TimeZone.ge"> <%@page import="java.util.Date"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>${time }
<% String[] zone = TimeZone.ge"> <%@page import="java.util.Date"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>${time }
<% String[] zone = TimeZone.ge"><%@page import="java.util.TimeZone"%>
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="<http://java.sun.com/jsp/jstl/core>" %>
<%@ taglib prefix="fmt" uri="<http://java.sun.com/jsp/jstl/fmt>" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ex10_fmt-date_time.jsp</title>
</head>
<body>
<%--
# <fmt:formatDate> : 날짜와 시간 포맷을 지정.
- <fmt:formatDate value="출력 날짜" type="출력 양식" var="변수 설정" dateStyle="날짜 스타일" timeStyle="시간 스타일" pattern="날짜 패턴" scope="범위"/>
* type : 출력시 날짜(data), 시간(time), 날짜 및 시간(both) 세가지 중 선택
dataStyle : default, short, medium( 기본값 ), long, full 중 선택
timeStyle : default, short, medium, long, full 중 선택
pattern : 출력할 날짜 및 시간 양식 지정.
--%>
<c:set var="today" value='<%=new java.util.Date()%>'/>
<fmt:formatDate var="time" value="${today }" type="both" dateStyle="full" timeStyle="full"/>
<p>${time }</p>
<%
String[] zone = TimeZone.getAvailableIDs();
for(int i=0; i<zone.length; i++) {
out.println(zone[i]);
}
%>
<fmt:timeZone value="ko_kR">
<fmt:formatDate var="myTime" value="${today }" type="both" pattern="yyyy-MM-dd hh:mm:ss"/>
<p>${myTime }</p>
</fmt:timeZone>
</body>
</html>