<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
1. <fmt:formatNumber value="1000000"/> <br>
2. <fmt:formatNumber value="1000000" groupingUsed="false"/><br>
3. <c:set var="number" value="123456789"/>
<fmt:formatNumber value="${number}"/><br>
4. <fmt:formatNumber var="fNumber" value="${number}"/>
${fNumber}<br>
통화 : <fmt:formatNumber value="${number}" type="currency" currencySymbol="원"/> , <fmt:formatNumber value="${number}" type="currency"/><br>
퍼센트 : <fmt:formatNumber value="${number/50000000}" type="percent"/><br>
패턴 : <fmt:formatNumber value="${number}" pattern="000,000,000.00"/>
</body>
</html>
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
request.setAttribute("now", new Date());
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%-- 전부 홍콩 시간대로 바귐 <fmt:timeZone value="Hongkong"> --%>
<b>date</b><br>
${now}<br>
<fmt:formatDate value="${now}"/><br>
<fmt:formatDate value="${now}" type="date"/><br>
<fmt:formatDate value="${now}" type="date" dateStyle="full"/><br>
<fmt:formatDate value="${now}" type="date" dateStyle="short"/><br>
<b>time</b><br>
<fmt:formatDate value="${now}" type="time"/><br>
<fmt:formatDate value="${now}" type="time" timeStyle="full"/><br>
<fmt:formatDate value="${now}" type="time" timeStyle="short"/><br>
<b>both</b><br>
<fmt:formatDate value="${now}" type="both"/><br>
<fmt:formatDate value="${now}" type="both" dateStyle="full" /><br>
<fmt:formatDate value="${now}" type="both" dateStyle="short" timeStyle="short"/><br>
<b>패턴</b> <br>
<fmt:formatDate value="${now}" pattern="z a h:mm"/><br>
<fmt:formatDate value="${now}" pattern="hh:mm"/><br>
<fmt:formatDate value="${now}" pattern="yyy-MM-dd h:mm"/><br>
<fmt:formatDate value="${now}" pattern="yyy-MM-dd h:mm" timeZone="Hongkong"/><br>
<%-- </fmt:timeZone> --%>
</body>
</html>
'JAVA > Jsp&Servlet' 카테고리의 다른 글
[JSP] FileUpload (0) | 2020.12.24 |
---|---|
[JSP] JSTL 설치 및 사용 / core <c:~> (0) | 2020.12.23 |
[JSP] 표현언어 EL / Expression Language (0) | 2020.12.23 |
[JSP] mysql JDBC (0) | 2020.12.18 |
[JSP] session 기본 객체 (0) | 2020.12.18 |
[JSP] 쿠키처리를 위한 유틸리티 클래스 만들기 (0) | 2020.12.17 |
[JSP] 쿠키 (0) | 2020.12.17 |