blob: 4d1a5c55f9c322fbb0ed3f1934fa3345a5725b73 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_281) on Sun Jan 15 15:58:35 CET 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DateUtil (FreeMarker 2.3.32 API)</title>
<meta name="date" content="2023-01-15">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="DateUtil (FreeMarker 2.3.32 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DateUtil.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../freemarker/template/utility/Constants.html" title="class in freemarker.template.utility"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?freemarker/template/utility/DateUtil.html" target="_top">Frames</a></li>
<li><a href="DateUtil.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">freemarker.template.utility</div>
<h2 title="Class DateUtil" class="title">Class DateUtil</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>freemarker.template.utility.DateUtil</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">DateUtil</span>
extends java.lang.Object</pre>
<div class="block">Date and time related utilities.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a></span></code>
<div class="block">Used internally by <a href="../../../freemarker/template/utility/DateUtil.html" title="class in freemarker.template.utility"><code>DateUtil</code></a>; don't use its implementations for anything else.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.DateToISO8601CalendarFactory.html" title="interface in freemarker.template.utility">DateUtil.DateToISO8601CalendarFactory</a></span></code>
<div class="block">Used internally by <a href="../../../freemarker/template/utility/DateUtil.html" title="class in freemarker.template.utility"><code>DateUtil</code></a>; don't use its implementations for
anything else.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.TrivialCalendarFieldsToDateConverter.html" title="class in freemarker.template.utility">DateUtil.TrivialCalendarFieldsToDateConverter</a></span></code>
<div class="block">Non-thread-safe implementation that hard-references a calendar internally.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.TrivialDateToISO8601CalendarFactory.html" title="class in freemarker.template.utility">DateUtil.TrivialDateToISO8601CalendarFactory</a></span></code>
<div class="block">Non-thread-safe factory that hard-references a calendar internally.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#ACCURACY_HOURS">ACCURACY_HOURS</a></span></code>
<div class="block">Show hours (24h); always 2 digits, like <code>00</code>, <code>05</code>, etc.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#ACCURACY_MILLISECONDS">ACCURACY_MILLISECONDS</a></span></code>
<div class="block">Show hours, minutes and seconds and up to 3 fraction second digits, without trailing 0-s in the fraction part.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#ACCURACY_MILLISECONDS_FORCED">ACCURACY_MILLISECONDS_FORCED</a></span></code>
<div class="block">Show hours, minutes and seconds and exactly 3 fraction second digits (even if it's 000)</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#ACCURACY_MINUTES">ACCURACY_MINUTES</a></span></code>
<div class="block">Show hours and minutes (even if minutes is 00).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#ACCURACY_SECONDS">ACCURACY_SECONDS</a></span></code>
<div class="block">Show hours, minutes and seconds (even if seconds is 00).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.util.TimeZone</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#UTC">UTC</a></span></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#dateToISO8601String-java.util.Date-boolean-boolean-boolean-int-java.util.TimeZone-freemarker.template.utility.DateUtil.DateToISO8601CalendarFactory-">dateToISO8601String</a></span>(java.util.Date&nbsp;date,
boolean&nbsp;datePart,
boolean&nbsp;timePart,
boolean&nbsp;offsetPart,
int&nbsp;accuracy,
java.util.TimeZone&nbsp;timeZone,
<a href="../../../freemarker/template/utility/DateUtil.DateToISO8601CalendarFactory.html" title="interface in freemarker.template.utility">DateUtil.DateToISO8601CalendarFactory</a>&nbsp;calendarFactory)</code>
<div class="block">Format a date, time or dateTime with one of the ISO 8601 extended
formats that is also compatible with the XML Schema format (as far as you
don't have dates in the BC era).</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#dateToXSString-java.util.Date-boolean-boolean-boolean-int-java.util.TimeZone-freemarker.template.utility.DateUtil.DateToISO8601CalendarFactory-">dateToXSString</a></span>(java.util.Date&nbsp;date,
boolean&nbsp;datePart,
boolean&nbsp;timePart,
boolean&nbsp;offsetPart,
int&nbsp;accuracy,
java.util.TimeZone&nbsp;timeZone,
<a href="../../../freemarker/template/utility/DateUtil.DateToISO8601CalendarFactory.html" title="interface in freemarker.template.utility">DateUtil.DateToISO8601CalendarFactory</a>&nbsp;calendarFactory)</code>
<div class="block">Same as <a href="../../../freemarker/template/utility/DateUtil.html#dateToISO8601String-java.util.Date-boolean-boolean-boolean-int-java.util.TimeZone-freemarker.template.utility.DateUtil.DateToISO8601CalendarFactory-"><code>dateToISO8601String(java.util.Date, boolean, boolean, boolean, int, java.util.TimeZone, freemarker.template.utility.DateUtil.DateToISO8601CalendarFactory)</code></a>, but gives XML Schema compliant format.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static java.util.TimeZone</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#getTimeZone-java.lang.String-">getTimeZone</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Returns the time zone object for the name (or ID).</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#parseISO8601Date-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">parseISO8601Date</a></span>(java.lang.String&nbsp;dateStr,
java.util.TimeZone&nbsp;defaultTimeZone,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)</code>
<div class="block">Same as <a href="../../../freemarker/template/utility/DateUtil.html#parseXSDate-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-"><code>parseXSDate(String, TimeZone, CalendarFieldsToDateConverter)</code></a>, but for ISO 8601 dates.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#parseISO8601DateTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">parseISO8601DateTime</a></span>(java.lang.String&nbsp;dateTimeStr,
java.util.TimeZone&nbsp;defaultTZ,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)</code>
<div class="block">Same as <a href="../../../freemarker/template/utility/DateUtil.html#parseXSDateTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-"><code>parseXSDateTime(String, TimeZone, CalendarFieldsToDateConverter)</code></a> but for ISO 8601 format.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#parseISO8601Time-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">parseISO8601Time</a></span>(java.lang.String&nbsp;timeStr,
java.util.TimeZone&nbsp;defaultTZ,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)</code>
<div class="block">Same as <a href="../../../freemarker/template/utility/DateUtil.html#parseXSTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-"><code>parseXSTime(String, TimeZone, CalendarFieldsToDateConverter)</code></a> but for ISO 8601 times.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#parseXSDate-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">parseXSDate</a></span>(java.lang.String&nbsp;dateStr,
java.util.TimeZone&nbsp;defaultTimeZone,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)</code>
<div class="block">Parses an W3C XML Schema date string (not time or date-time).</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#parseXSDateTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">parseXSDateTime</a></span>(java.lang.String&nbsp;dateTimeStr,
java.util.TimeZone&nbsp;defaultTZ,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)</code>
<div class="block">Parses an W3C XML Schema date-time string (not date or time).</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static java.util.Date</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#parseXSTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">parseXSTime</a></span>(java.lang.String&nbsp;timeStr,
java.util.TimeZone&nbsp;defaultTZ,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)</code>
<div class="block">Parses an W3C XML Schema time string (not date or date-time).</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static java.util.TimeZone</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/DateUtil.html#parseXSTimeZone-java.lang.String-">parseXSTimeZone</a></span>(java.lang.String&nbsp;timeZoneStr)</code>
<div class="block">Parses the time zone part from a W3C XML Schema date/time/dateTime.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="ACCURACY_HOURS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ACCURACY_HOURS</h4>
<pre>public static final&nbsp;int ACCURACY_HOURS</pre>
<div class="block">Show hours (24h); always 2 digits, like <code>00</code>, <code>05</code>, etc.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#freemarker.template.utility.DateUtil.ACCURACY_HOURS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ACCURACY_MINUTES">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ACCURACY_MINUTES</h4>
<pre>public static final&nbsp;int ACCURACY_MINUTES</pre>
<div class="block">Show hours and minutes (even if minutes is 00).</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#freemarker.template.utility.DateUtil.ACCURACY_MINUTES">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ACCURACY_SECONDS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ACCURACY_SECONDS</h4>
<pre>public static final&nbsp;int ACCURACY_SECONDS</pre>
<div class="block">Show hours, minutes and seconds (even if seconds is 00).</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#freemarker.template.utility.DateUtil.ACCURACY_SECONDS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ACCURACY_MILLISECONDS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ACCURACY_MILLISECONDS</h4>
<pre>public static final&nbsp;int ACCURACY_MILLISECONDS</pre>
<div class="block">Show hours, minutes and seconds and up to 3 fraction second digits, without trailing 0-s in the fraction part.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#freemarker.template.utility.DateUtil.ACCURACY_MILLISECONDS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ACCURACY_MILLISECONDS_FORCED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ACCURACY_MILLISECONDS_FORCED</h4>
<pre>public static final&nbsp;int ACCURACY_MILLISECONDS_FORCED</pre>
<div class="block">Show hours, minutes and seconds and exactly 3 fraction second digits (even if it's 000)</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#freemarker.template.utility.DateUtil.ACCURACY_MILLISECONDS_FORCED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="UTC">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>UTC</h4>
<pre>public static final&nbsp;java.util.TimeZone UTC</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getTimeZone-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTimeZone</h4>
<pre>public static&nbsp;java.util.TimeZone&nbsp;getTimeZone(java.lang.String&nbsp;name)
throws <a href="../../../freemarker/template/utility/UnrecognizedTimeZoneException.html" title="class in freemarker.template.utility">UnrecognizedTimeZoneException</a></pre>
<div class="block">Returns the time zone object for the name (or ID). This differs from
<code>TimeZone.getTimeZone(String)</code> in that the latest returns GMT
if it doesn't recognize the name, while this throws an
<a href="../../../freemarker/template/utility/UnrecognizedTimeZoneException.html" title="class in freemarker.template.utility"><code>UnrecognizedTimeZoneException</code></a>.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/utility/UnrecognizedTimeZoneException.html" title="class in freemarker.template.utility">UnrecognizedTimeZoneException</a></code> - If the time zone name wasn't understood</dd>
</dl>
</li>
</ul>
<a name="dateToISO8601String-java.util.Date-boolean-boolean-boolean-int-java.util.TimeZone-freemarker.template.utility.DateUtil.DateToISO8601CalendarFactory-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dateToISO8601String</h4>
<pre>public static&nbsp;java.lang.String&nbsp;dateToISO8601String(java.util.Date&nbsp;date,
boolean&nbsp;datePart,
boolean&nbsp;timePart,
boolean&nbsp;offsetPart,
int&nbsp;accuracy,
java.util.TimeZone&nbsp;timeZone,
<a href="../../../freemarker/template/utility/DateUtil.DateToISO8601CalendarFactory.html" title="interface in freemarker.template.utility">DateUtil.DateToISO8601CalendarFactory</a>&nbsp;calendarFactory)</pre>
<div class="block">Format a date, time or dateTime with one of the ISO 8601 extended
formats that is also compatible with the XML Schema format (as far as you
don't have dates in the BC era). Examples of possible outputs:
<code>"2005-11-27T15:30:00+02:00"</code>, <code>"2005-11-27"</code>,
<code>"15:30:00Z"</code>. Note the <code>":00"</code> in the time zone offset;
this is not required by ISO 8601, but included for compatibility with
the XML Schema format. Regarding the B.C. issue, those dates will be
one year off when read back according the XML Schema format, because of a
mismatch between that format and ISO 8601:2000 Second Edition.
<p>This method is thread-safe.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>date</code> - the date to convert to ISO 8601 string</dd>
<dd><code>datePart</code> - whether the date part (year, month, day) will be included
or not</dd>
<dd><code>timePart</code> - whether the time part (hours, minutes, seconds,
milliseconds) will be included or not</dd>
<dd><code>offsetPart</code> - whether the time zone offset part will be included or
not. This will be shown as an offset to UTC (examples:
<code>"+01"</code>, <code>"-02"</code>, <code>"+04:30"</code>) or as <code>"Z"</code>
for UTC (and for UT1 and for GMT+00, since the Java platform
doesn't really care about the difference).
Note that this can't be <code>true</code> when <code>timePart</code> is
<code>false</code>, because ISO 8601 (2004) doesn't mention such
patterns.</dd>
<dd><code>accuracy</code> - tells which parts of the date/time to drop. The
<code>datePart</code> and <code>timePart</code> parameters are stronger than
this. Note that when <a href="../../../freemarker/template/utility/DateUtil.html#ACCURACY_MILLISECONDS"><code>ACCURACY_MILLISECONDS</code></a> is specified,
the milliseconds part will be displayed as fraction seconds
(like <code>"15:30.00.25"</code>) with the minimum number of
digits needed to show the milliseconds without precision lose.
Thus, if the milliseconds happen to be exactly 0, no fraction
seconds will be shown at all.</dd>
<dd><code>timeZone</code> - the time zone in which the date/time will be shown. (You
may find <a href="../../../freemarker/template/utility/DateUtil.html#UTC"><code>UTC</code></a> handy here.) Note
that although date-only formats has no time zone offset part,
the result still depends on the time zone, as days start and end
at different points on the time line in different zones.</dd>
<dd><code>calendarFactory</code> - the factory that will create the calendar used
internally for calculations. The point of this parameter is that
creating a new calendar is relatively expensive, so it's desirable
to reuse calendars and only set their time and zone. (This was
tested on Sun JDK 1.6 x86 Win, where it gave 2x-3x speedup.)</dd>
</dl>
</li>
</ul>
<a name="dateToXSString-java.util.Date-boolean-boolean-boolean-int-java.util.TimeZone-freemarker.template.utility.DateUtil.DateToISO8601CalendarFactory-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dateToXSString</h4>
<pre>public static&nbsp;java.lang.String&nbsp;dateToXSString(java.util.Date&nbsp;date,
boolean&nbsp;datePart,
boolean&nbsp;timePart,
boolean&nbsp;offsetPart,
int&nbsp;accuracy,
java.util.TimeZone&nbsp;timeZone,
<a href="../../../freemarker/template/utility/DateUtil.DateToISO8601CalendarFactory.html" title="interface in freemarker.template.utility">DateUtil.DateToISO8601CalendarFactory</a>&nbsp;calendarFactory)</pre>
<div class="block">Same as <a href="../../../freemarker/template/utility/DateUtil.html#dateToISO8601String-java.util.Date-boolean-boolean-boolean-int-java.util.TimeZone-freemarker.template.utility.DateUtil.DateToISO8601CalendarFactory-"><code>dateToISO8601String(java.util.Date, boolean, boolean, boolean, int, java.util.TimeZone, freemarker.template.utility.DateUtil.DateToISO8601CalendarFactory)</code></a>, but gives XML Schema compliant format.</div>
</li>
</ul>
<a name="parseXSDate-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseXSDate</h4>
<pre>public static&nbsp;java.util.Date&nbsp;parseXSDate(java.lang.String&nbsp;dateStr,
java.util.TimeZone&nbsp;defaultTimeZone,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)
throws <a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></pre>
<div class="block">Parses an W3C XML Schema date string (not time or date-time).
Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>dateStr</code> - the string to parse.</dd>
<dd><code>defaultTimeZone</code> - used if the date doesn't specify the
time zone offset explicitly. Can't be <code>null</code>.</dd>
<dd><code>calToDateConverter</code> - Used internally to calculate the result from the calendar field values.
If you don't have a such object around, you can just use
<code>new </code><a href="../../../freemarker/template/utility/DateUtil.TrivialCalendarFieldsToDateConverter.html" title="class in freemarker.template.utility"><code>DateUtil.TrivialCalendarFieldsToDateConverter</code></a><code>()</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></code> - if the date is malformed, or if the time
zone offset is unspecified and the <code>defaultTimeZone</code> is
<code>null</code>.</dd>
</dl>
</li>
</ul>
<a name="parseISO8601Date-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseISO8601Date</h4>
<pre>public static&nbsp;java.util.Date&nbsp;parseISO8601Date(java.lang.String&nbsp;dateStr,
java.util.TimeZone&nbsp;defaultTimeZone,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)
throws <a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></pre>
<div class="block">Same as <a href="../../../freemarker/template/utility/DateUtil.html#parseXSDate-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-"><code>parseXSDate(String, TimeZone, CalendarFieldsToDateConverter)</code></a>, but for ISO 8601 dates.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></code></dd>
</dl>
</li>
</ul>
<a name="parseXSTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseXSTime</h4>
<pre>public static&nbsp;java.util.Date&nbsp;parseXSTime(java.lang.String&nbsp;timeStr,
java.util.TimeZone&nbsp;defaultTZ,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)
throws <a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></pre>
<div class="block">Parses an W3C XML Schema time string (not date or date-time).
If the time string doesn't specify the time zone offset explicitly,
the value of the <code>defaultTZ</code> paramter will be used.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></code></dd>
</dl>
</li>
</ul>
<a name="parseISO8601Time-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseISO8601Time</h4>
<pre>public static&nbsp;java.util.Date&nbsp;parseISO8601Time(java.lang.String&nbsp;timeStr,
java.util.TimeZone&nbsp;defaultTZ,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)
throws <a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></pre>
<div class="block">Same as <a href="../../../freemarker/template/utility/DateUtil.html#parseXSTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-"><code>parseXSTime(String, TimeZone, CalendarFieldsToDateConverter)</code></a> but for ISO 8601 times.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></code></dd>
</dl>
</li>
</ul>
<a name="parseXSDateTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseXSDateTime</h4>
<pre>public static&nbsp;java.util.Date&nbsp;parseXSDateTime(java.lang.String&nbsp;dateTimeStr,
java.util.TimeZone&nbsp;defaultTZ,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)
throws <a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></pre>
<div class="block">Parses an W3C XML Schema date-time string (not date or time).
Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>dateTimeStr</code> - the string to parse.</dd>
<dd><code>defaultTZ</code> - used if the dateTime doesn't specify the
time zone offset explicitly. Can't be <code>null</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></code> - if the dateTime is malformed.</dd>
</dl>
</li>
</ul>
<a name="parseISO8601DateTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseISO8601DateTime</h4>
<pre>public static&nbsp;java.util.Date&nbsp;parseISO8601DateTime(java.lang.String&nbsp;dateTimeStr,
java.util.TimeZone&nbsp;defaultTZ,
<a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility">DateUtil.CalendarFieldsToDateConverter</a>&nbsp;calToDateConverter)
throws <a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></pre>
<div class="block">Same as <a href="../../../freemarker/template/utility/DateUtil.html#parseXSDateTime-java.lang.String-java.util.TimeZone-freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter-"><code>parseXSDateTime(String, TimeZone, CalendarFieldsToDateConverter)</code></a> but for ISO 8601 format.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></code></dd>
</dl>
</li>
</ul>
<a name="parseXSTimeZone-java.lang.String-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>parseXSTimeZone</h4>
<pre>public static&nbsp;java.util.TimeZone&nbsp;parseXSTimeZone(java.lang.String&nbsp;timeZoneStr)
throws <a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></pre>
<div class="block">Parses the time zone part from a W3C XML Schema date/time/dateTime.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/utility/DateUtil.DateParseException.html" title="class in freemarker.template.utility">DateUtil.DateParseException</a></code> - if the zone is malformed.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DateUtil.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../freemarker/template/utility/Constants.html" title="class in freemarker.template.utility"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../freemarker/template/utility/DateUtil.CalendarFieldsToDateConverter.html" title="interface in freemarker.template.utility"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?freemarker/template/utility/DateUtil.html" target="_top">Frames</a></li>
<li><a href="DateUtil.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>