js| Currency | date
1. Format currency
Many countries in the world have different currency formats and digital format conventions. correctly formatting and displaying the currency for a specific localized environment is an important part of localization.
<%@ page 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"%>
<title>currency formatting</title>
<body>
<fmt:setlocale value= "en_GB"/>
<fmt:formatnumber type= "Currency" value= "80000"/><br/>
<fmt:setlocale value= "en_US"/>
<fmt:formatnumber type= "Currency" value= "80000"/><br/>
<fmt:setlocale value= "Fr_fr"/>
<fmt:formatnumber type= "Currency" value= "80000"/><br/>
<fmt:setlocale value= "Ja_jp"/>
<fmt:formatnumber type= "Currency" value= "80000"/><br/>
<fmt:setlocale value= "Ko_kr"/>
<fmt:formatnumber type= "Currency" value= "80000"/><br/>
<fmt:setlocale value= "Es_es"/>
<fmt:formatnumber type= "Currency" value= "80000"/><br/>
<fmt:setlocale value= "Ar_eg"/>
<fmt:formatnumber type= "Currency" value= "80000"/><br/>
<fmt:setlocale value= "en_GB"/>
<fmt:formatnumber type= "Currency" value= "80000"/><br/>
<fmt:formatnumber type= "Currency" value= "80000" currencycode= "EUR"/><br/>
</body>
2. Format Date
Similar to digital and currency formatting, the localization environment also affects how dates and times are generated.
<%@ page 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"%>
<title>date formatting</title>
<body>
<fmt:timezone value= "EST" >
<jsp:usebean id= "CurrentTime" class= "Java.util.Date"/>
<fmt:setlocale value= "en_GB"/>
<fmt:formatdate type= "Both" datestyle= "full" timestyle= "full" value= "${currenttime}"/><br/>
<fmt:setlocale value= "en_US"/>
<fmt:formatdate type= "Both" datestyle= "full" timestyle= "full" value= "${currenttime}"/><br/>
<fmt:setlocale value= "Fr_fr"/>
<fmt:formatdate type= "Both" datestyle= "full" timestyle= "full" value= "${currenttime}"/><br/>
<fmt:setlocale value= "Ja_jp"/>
<fmt:formatdate type= "Both" datestyle= "full" timestyle= "full" value= "${currenttime}"/><br/>
<fmt:setlocale value= "Ko_kr"/>
<fmt:formatdate type= "Both" datestyle= "full" timestyle= "full" value= "${currenttime}"/><br/>
<fmt:setlocale value= "Es_es"/>
<fmt:formatdate type= "Both" datestyle= "full" timestyle= "full" value= "${currenttime}"/><br/>
<fmt:setlocale value= "Ar_eg"/>
<fmt:formatdate type= "Both" datestyle= "full" timestyle= "full" value= "${currenttime}"/><br/>
</fmt:timeZone>
</body>
Properties of <fmt:formatDate> Actions
Type: can be time,date or both. Controls whether only the time is generated, only the date is generated, or the time date is generated.
Datestyle: Can be short, medium, long or full (default). Controls the exact format used by the print date.
Timestyle: Can be short, medium, long or full (default). Controls the specific format used for printing time.
Value: This is a java.util.Date type value that is used to generate the date and time.