http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_builtins_alphaidx.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_builtins_alphaidx.html b/builds/2.3.26-nightly/ref_builtins_alphaidx.html new file mode 100644 index 0000000..08c1ad4 --- /dev/null +++ b/builds/2.3.26-nightly/ref_builtins_alphaidx.html @@ -0,0 +1,503 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>Alphabetical index - Apache FreeMarker Manual</title> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<meta name="format-detection" content="telephone=no"> +<meta property="og:site_name" content="Apache FreeMarker Manual"> +<meta property="og:title" content="Alphabetical index"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_builtins_alphaidx.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_builtins_alphaidx.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache FreeMarker Manual"> + + <!--[if lte IE 9]> + <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> + <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Template Language Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_builtins.html"><span itemprop="name">Built-in Reference</span></a></li><li class="step-3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_builtins_alphaidx.html"><span itemprop="name">Alphabetical index</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li>?builtins</li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","Template Language Reference","Built-in Reference","Alphabetical index"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_builtins.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_builtins_string.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_builtins_alphaidx" itemprop="headline">Alphabetical index</h1> +</div></div> <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>As of FreeMarker 2.3.23, you can use camel case instead of + snake case for directive names, like <code class="inline-code">startsWith</code> + instead of <code class="inline-code">starts_with</code>. But know that then within + the same template, FreeMarker will enforce the usage of camel case + for all identifiers that are part of the template language (user + defined names are not affected).</p> + </div> +<ul> + <li> + <a href="ref_builtins_number.html#ref_builtin_abs">abs</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_ancestors">ancestors</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_buitin_api_and_has_api">api</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_boolean">boolean</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_numType">byte</a> + </li> + + <li> + c <a href="ref_builtins_number.html#ref_builtin_c">for strings</a>, <a href="ref_builtins_boolean.html#ref_builtin_c_boolean">for booleans</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_cap_first">cap_first</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_capitalize">capitalize</a> + </li> + + <li> + <a href="ref_builtins_number.html#ref_builtin_rounding">ceiling</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_children">children</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_chop_linebreak">chop_linebreak</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_chunk">chunk</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_contains">contains</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_counter">counter</a> + </li> + + <li> + date <a href="ref_builtins_date.html#ref_builtin_date_datetype">for + dates</a>, <a href="ref_builtins_string.html#ref_builtin_string_date">for + strings</a> + </li> + + <li> + <a href="ref_builtins_date.html#ref_builtin_date_if_unknown">date_if_unknown</a> + </li> + + <li> + datetime <a href="ref_builtins_date.html#ref_builtin_date_datetype">for + dates</a>, <a href="ref_builtins_string.html#ref_builtin_string_date">for + strings</a> + </li> + + <li> + <a href="ref_builtins_date.html#ref_builtin_date_if_unknown">datetime_if_unknown</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_numType">double</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_esc">esc</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_ends_with">ends_with</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_ensure_ends_with">ensure_ends_with</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_ensure_starts_with">ensure_starts_with</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_eval">eval</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_first">first</a> + </li> + + <li> + <a href="ref_builtins_number.html#ref_builtin_rounding">floor</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_groups">groups</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_numType">float</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_buitin_api_and_has_api">has_api</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_has_content">has_content</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_has_next">has_next</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_html">html</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_index">index</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_index_of">index_of</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_numType">int</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_interpret">interpret</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_item_cycle">item_cycle</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_item_parity">item_parity</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_item_parity_cap">item_parity_cap</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_is_even_item">is_even_item</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_first">is_first</a> + </li> + + <li> + <a href="ref_builtins_number.html#ref_builtin_is_infinite">is_infinite</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_is_last">is_last</a> + </li> + + <li> + <a href="ref_builtins_number.html#ref_builtin_is_nan">is_nan</a> + </li> + + <li> + <a href="ref_builtins_loop_var.html#ref_builtin_is_odd_item">is_odd_item</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_isType">is_<em>type</em></a> + </li> + + <li> + <a href="ref_builtins_date.html#ref_builtin_date_iso">iso, + iso_...</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_j_string">j_string</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_join">join</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_js_string">js_string</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_keep_after">keep_after</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_keep_after_last">keep_after_last</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_keep_before">keep_before</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_keep_before_last">keep_before_last</a> + </li> + + <li> + <a href="ref_builtins_hash.html#ref_builtin_keys">keys</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_last">last</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_last_index_of">last_index_of</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_left_pad">left_pad</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_length">length</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_numType">long</a> + </li> + + <li> + <a href="ref_builtins_number.html#ref_builtin_lower_abc">lower_abc</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_lower_case">lower_case</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_markup_string">markup_string</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_matches">matches</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_namespace">namespace</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_new">new</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_next_sibling">next_sibling</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_no_esc">no_esc</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_node_namespace">node_namespace</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_node_name">node_name</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_node_type">node_type</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_number">number</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_numToDate">number_to_date, + number_to_datetime, number_to_time</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_parent">parent</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_previous_sibling">previous_sibling</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_replace">replace</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_remove_beginning">remove_beginning</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_remove_ending">remove_ending</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_reverse">reverse</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_right_pad">right_pad</a> + </li> + + <li> + <a href="ref_builtins_number.html#ref_builtin_rounding">round</a> + </li> + + <li> + <a href="ref_builtins_node.html#ref_builtin_root">root</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_rtf">rtf</a> + </li> + + <li> + <a href="ref_builtins_expert.html#ref_builtin_numType">short</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_size">size</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_sort">sort</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_seq_contains">seq_contains</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_seq_index_of">seq_index_of</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_seq_last_index_of">seq_last_index_of</a> + </li> + + <li> + <a href="ref_builtins_sequence.html#ref_builtin_sort_by">sort_by</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_split">split</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_starts_with">starts_with</a> + </li> + + <li> + string: <a href="ref_builtins_string.html#ref_builtin_string_for_string">for + strings</a>, <a href="ref_builtins_number.html#ref_builtin_string_for_number">for + numbers</a>, <a href="ref_builtins_boolean.html#ref_builtin_string_for_boolean">for + booleans</a>, <a href="ref_builtins_date.html#ref_builtin_string_for_date">for + date/time/date-time</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_substring">substring</a> + (deprecated) + </li> + + <li> + <a href="ref_builtins_type_independent.html#ref_builtin_switch">switch</a> + </li> + + <li> + <a href="ref_builtins_boolean.html#ref_builtin_then">then</a> + </li> + + <li> + time <a href="ref_builtins_date.html#ref_builtin_date_datetype">for + date/time/date-time</a>, <a href="ref_builtins_string.html#ref_builtin_string_date">for strings</a> + </li> + + <li> + <a href="ref_builtins_date.html#ref_builtin_date_if_unknown">time_if_unknown</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_trim">trim</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_uncap_first">uncap_first</a> + </li> + + <li> + <a href="ref_builtins_number.html#ref_builtin_upper_abc">upper_abc</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_upper_case">upper_case</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_url">url</a> + </li> + + <li> + <a href="ref_builtins_hash.html#ref_builtin_values">values</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_word_list">word_list</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_xhtml">xhtml</a> + </li> + + <li> + <a href="ref_builtins_string.html#ref_builtin_xml">xml</a> + </li> + </ul><p>See the built-ins filtered by left-hand-value type <a href="ref_builtins.html">here</a>.</p><p>If you don't find a built-in here that you have seen in a + working template, probably you will find it here: <a href="ref_deprecated.html">Deprecated FTL constructs</a></p><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_builtins.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_builtins_string.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_builtins_boolean.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_builtins_boolean.html b/builds/2.3.26-nightly/ref_builtins_boolean.html new file mode 100644 index 0000000..5bdd23c --- /dev/null +++ b/builds/2.3.26-nightly/ref_builtins_boolean.html @@ -0,0 +1,229 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>Built-ins for booleans - Apache FreeMarker Manual</title> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<meta name="format-detection" content="telephone=no"> +<meta property="og:site_name" content="Apache FreeMarker Manual"> +<meta property="og:title" content="Built-ins for booleans"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_builtins_boolean.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_builtins_boolean.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache FreeMarker Manual"> + + <!--[if lte IE 9]> + <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> + <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Template Language Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_builtins.html"><span itemprop="name">Built-in Reference</span></a></li><li class="step-3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_builtins_boolean.html"><span itemprop="name">Built-ins for booleans</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","Template Language Reference","Built-in Reference","Built-ins for booleans"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_builtins_date.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_builtins_sequence.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_builtins_boolean" itemprop="headline">Built-ins for booleans</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#ref_builtin_c_boolean" data-menu-target="ref_builtin_c_boolean">c (when used with boolean)</a></li><li><a class="page-menu-link" href="#ref_builtin_string_for_boolean" data-menu-target="ref_builtin_string_for_boolean">string (when used with a boolean value)</a></li><li><a class="page-menu-link" href="#ref_builtin_then" data-menu-target="ref_builtin_then">then</a></li></ul> </div> + + + + +<h2 class="content-header header-section2" id="ref_builtin_c_boolean">c (when used with boolean)</h2> + + + + + + + + + + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>This built-in exists since FreeMarker 2.3.20.</p> + </div> + + + <p>This built-in converts a boolean to string for a + "computer language" as opposed to for human audience. + The result will be <code class="inline-code">"true"</code> or + <code class="inline-code">"false"</code>, regardless of the + <code class="inline-code">boolean_format</code> setting. When generating + JavaScript and such, this should be used, as otherwise changing the + <code class="inline-code">boolean_format</code> can break the generated + computer-language output.</p> + + <p>Note that this built-in <a href="ref_builtins_number.html#ref_builtin_c">also + works on strings</a>.</p> + + + + + +<h2 class="content-header header-section2" id="ref_builtin_string_for_boolean">string (when used with a boolean value)</h2> + + + + + + + + + + + + + <p><em>All usages of this built-in has been deprecated; see + below.</em></p> + + <p>Converts a boolean to a string. You can use it in two + ways:</p> + + <ul> + <li> + <p>As <code class="inline-code">foo?string("yes", "no")</code>: + <em>Deprecated starting from FreeMarker 2.3.23: use <a href="#ref_builtin_then"><code>?then("yes", + "no")</code></a> instead. </em>This will return the + first parameter (here: <code class="inline-code">"yes"</code>) if the boolean + is true, otherwise the second parameter (here: + <code class="inline-code">"no"</code>). Note that the return value is always a + string; if the parameters were numbers, they would be converted + to strings first. Also note that both parameters are evaluated, + despite that only one of them will be used; this might have + negative impact if the parameters aren't just literals.</p> + </li> + + <li> + <p><code class="inline-code">foo?string</code>: <em>Deprecated + starting from FreeMarker 2.3.20: use <a href="#ref_builtin_c_boolean"><code>?c</code></a> + instead, or set the <code class="inline-code">boolean_format</code> <a href="ref_directive_setting.html">setting</a> to something like + <code class="inline-code">"yes,no"</code> and then the conversion can happen + automatically</em>. If you still need to know about this, + this will convert the boolean to string using the default + strings for representing true and false values. By default, true + is rendered as <code class="inline-code">"true"</code> and false is rendered + as <code class="inline-code">"false"</code>. This is mostly useful if you + generate source code with FreeMarker <em>(but use + <code class="inline-code">?c</code> for that starting from 2.3.20)</em>, + since the values are not locale (language, country) sensitive. + To change these default strings, you can use the + <code class="inline-code">boolean_format</code> <a href="ref_directive_setting.html">setting</a>.</p> + + <p class="programmers-note">Note, that in the very rare case + when a value is multi-typed and is both a boolean and a string, + then the string value of the variable will be returned, and so + the <code class="inline-code">boolean_format</code> setting will have no + effect.</p> + </li> + </ul> + + + + + +<h2 class="content-header header-section2" id="ref_builtin_then">then</h2> + + + + + + + + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>This built-in exists since FreeMarker 2.3.23.</p> + </div> + + + <p>Used like + <code class="inline-code"><em class="code-color">booleanExp</em>?then(<em class="code-color">whenTrue</em>, + <em class="code-color">whenFalse</em>)</code>, fills the same role + as the ternary operator in C-like languages (i.e., + <code class="inline-code"><em class="code-color">booleanExp</em> ? + <em class="code-color">whenTrue</em> : + <em class="code-color">whenFalse</em></code>). If + <code class="inline-code"><em class="code-color">booleanExp</em></code> evaluates + to boolean true then it evaluates and returns its first argument, or + else if <code class="inline-code"><em class="code-color">booleanExp</em></code> + evaluates to boolean false then it evaluates and return its second + argument. Off course, all three expression can be arbitrary complex. + The argument expressions can have any type, even different + types.</p> + + <p>An important special property of this built-in is that only + one of the argument expressions will be evaluated. This is unlike + with normal method calls, where all argument expressions are + evaluated, regardless if the method will need them. This also means + that the argument that's not needed can even refer to missing + variables without causing error. (It still can't be syntactically + invalid of course.)</p> + + <p>Example:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#assign foo = true> +${foo?then('Y', 'N')} + +<#assign foo = false> +${foo?then('Y', 'N')} + +<#assign x = 10> +<#assign y = 20> +<#-- Prints 100 plus the maximum of x and y: --> +${100 + (x > y)?then(x, y)}</pre></div> + + + +<div class="code-wrapper"><pre class="code-block code-output">Y + +N + +120</pre></div> + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>If you need to choose based on a non-boolean value, you + should use the <a href="ref_builtins_type_independent.html#ref_builtin_switch"><code>switch</code> + built-in</a> instead of nesting multiple + <code class="inline-code">then</code>-s into each other, like + <code class="inline-code">priority?switch(1, "low", 2, "medium", 3, + "high")</code>, or even <code class="inline-code">true?switch(priority <= 1, + "low", priority == 2, "medium", priority >= 3, + "high")</code>.</p> + </div> + + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_builtins_date.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_builtins_sequence.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_builtins_date.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_builtins_date.html b/builds/2.3.26-nightly/ref_builtins_date.html new file mode 100644 index 0000000..1548cdd --- /dev/null +++ b/builds/2.3.26-nightly/ref_builtins_date.html @@ -0,0 +1,545 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>Built-ins for date/time/date-time values - Apache FreeMarker Manual</title> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<meta name="format-detection" content="telephone=no"> +<meta property="og:site_name" content="Apache FreeMarker Manual"> +<meta property="og:title" content="Built-ins for date/time/date-time values"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_builtins_date.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_builtins_date.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache FreeMarker Manual"> + + <!--[if lte IE 9]> + <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> + <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Template Language Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_builtins.html"><span itemprop="name">Built-in Reference</span></a></li><li class="step-3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_builtins_date.html"><span itemprop="name">Built-ins for date/time/date-time values</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","Template Language Reference","Built-in Reference","Built-ins for date/time/date-time values"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_builtins_number.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_builtins_boolean.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_builtins_date" itemprop="headline">Built-ins for date/time/date-time values</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#ref_builtin_date_datetype" data-menu-target="ref_builtin_date_datetype">date, time, datetime (when used with a date/time/date-time +value)</a></li><li><a class="page-menu-link" href="#ref_builtin_date_if_unknown" data-menu-target="ref_builtin_date_if_unknown">date_if_unknown, time_if_unknown, datetime_if_unknown</a></li><li><a class="page-menu-link" href="#ref_builtin_date_iso" data-menu-target="ref_builtin_date_iso">iso_...</a></li><li><a class="page-menu-link" href="#ref_builtin_string_for_date" data-menu-target="ref_builtin_string_for_date">string (when used with a date/time/date-time value)</a></li></ul> </div> + + + + +<h2 class="content-header header-section2" id="ref_builtin_date_datetype">date, time, datetime (when used with a date/time/date-time + value)</h2> + + + + + + + + + + + + + <p>These built-ins can be used to specify which parts of the + date-like variable are in use:</p> + + <ul> + <li> + <p><code class="inline-code">date</code>: Date only, no time of the + day.</p> + </li> + + <li> + <p><code class="inline-code">time</code>: Only the time of the day, no date + part</p> + </li> + + <li> + <p><code class="inline-code">datetime</code>: Both date and time</p> + </li> + </ul> + + <p>Ideally, you do not need to use these built-ins. + Unfortunately, because of the technical limitations of the Java + platform, FreeMarker sometimes can't find out which parts of a + date-like value is a date, a time or a date-time; ask the + programmers which variables has this problem. If FreeMarker has to + execute an operation where this information is needed -- such as + displaying the value as text -- but it does not know which parts are + in use, it will stop with error. This is when you have to use these + built-ins. For example, assume <code class="inline-code">openingTime</code> is a + such problematic variable:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#assign x = openingTime> <#-- no problem can occur here --> +${openingTime?time} <#-- without ?time it would fail --> +<#-- For the sake of better understanding, consider this: --> +<#assign openingTime = openingTime?time> +${openingTime} <#-- this will work now --></pre></div> + + <p>These built-ins can also be used to convert date-time values + to date or time. For example:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template">Last updated: ${lastUpdated} <#-- assume that lastUpdated is a date-time value --> +Last updated date: ${lastUpdated?date} +Last updated time: ${lastUpdated?time}</pre></div> + + <p>will output something like:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">Last updated: 04/25/2003 08:00:54 PM +Last updated date: 04/25/2003 +Last updated time: 08:00:54 PM</pre></div> + + <p>If the left side of the <code class="inline-code">?</code> is string, then + these built-ins <a href="ref_builtins_string.html#ref_builtin_string_date">convert + strings to date/time/date-time</a>.</p> + + + + + +<h2 class="content-header header-section2" id="ref_builtin_date_if_unknown">date_if_unknown, time_if_unknown, datetime_if_unknown</h2> + + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>This built-in exists since FreeMarker 2.3.21.</p> + </div> + + + <p>The <code class="inline-code">date_if_unknown</code>, + <code class="inline-code">time_if_unknown</code>, + <code class="inline-code">datetime_if_unknown</code> built-ins mark a date-like + value with some of the sub-types: date without time, time, or + date-time, respectively. However, if the value already holds this + information, the built-in has no effect. That is, it will never + convert the sub-type of a value, it only adds the sub-type if it was + unknown.</p> + + + + + +<h2 class="content-header header-section2" id="ref_builtin_date_iso">iso_...</h2> + + + + + + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p><em>These built-ins are deprecated</em> since + FreeMarker 2.3.21, where the <code class="inline-code">date_format</code>, + <code class="inline-code">time_format</code> and + <code class="inline-code">datetime_format</code> settings understand + <code class="inline-code">"iso"</code> (for ISO 8601:2004 format) and + <code class="inline-code">"xs"</code> (for XML Schema format) in additionally to + the Java <code class="inline-code">SimpleDateFormat</code> patterns. Thus the + default format can be set to ISO 8601, or for one time ISO + formatting you can use <code class="inline-code">myDate?string.iso</code>. <a href="ref_directive_setting.html#topic.dateTimeFormatSettings">See more + here...</a></p> + </div> + + + <p>These built-ins convert a date, time or date-time value to + string that follows ISO 8601:2004 "extended" format.</p> + + <p>This built-in has several variations: + <code class="inline-code">iso_utc</code>, <code class="inline-code">iso_local</code>, + <code class="inline-code">iso_utc_nz</code>, <code class="inline-code">iso_local_nz</code>, + <code class="inline-code">iso_utc_m</code>, <code class="inline-code">iso_utc_m_nz</code>, etc. + The name is constructed from the following words in this order, each + separated with a <code class="inline-code">_</code> from the next:</p> + + <div class="orderedlist"><ol type="1"> + <li> + <p><code class="inline-code">iso</code> (required)</p> + </li> + + <li> + <p>Either <code class="inline-code">utc</code> or <code class="inline-code">local</code> + (required (except when it's given with a parameter, but see that + later)): Specifies whether you want to print the + date/time/date-time according to UTC or according the current + time zone. The current time zone is decided by the + <code class="inline-code">time_zone</code> FreeMarker setting and is normally + configured by the programmers outside the templates (but it can + also be set in a template, like <code class="inline-code"><#setting + time_zone="America/New_York"></code> for example). Note + that if the <code class="inline-code">sql_date_and_time_time_zone</code> + FreeMarker setting is set and non-<code class="inline-code">null</code>, then + for <code class="inline-code">java.sql.Date</code> and + <code class="inline-code">java.sql.Time</code> values (i.e., for date-only and + time-only values that are coming from database via SQL) + <code class="inline-code">local</code> will mean that time zone instead of the + value of the <code class="inline-code">time_zone</code> setting.</p> + </li> + + <li> + <p>Either <code class="inline-code">h</code> or <code class="inline-code">m</code> or + <code class="inline-code">ms</code> (optional): The accuracy of the time part. + When omitted, it defaults to seconds accuracy (like + <code class="inline-code">12:30:18</code>). <code class="inline-code">h</code> means hours + accuracy (like <code class="inline-code">12</code>), <code class="inline-code">m</code> + means minutes accuracy (<code class="inline-code">12:30</code>), and + <code class="inline-code">ms</code> means milliseconds accuracy + (<code class="inline-code">12:30:18.25</code>, where we have 250 ms). Note + that when using <code class="inline-code">ms</code>, the milliseconds are + displayed as fraction seconds (following the standard) and will + not have trailing <code class="inline-code">0</code>-s. Thus, if the the + millisecond part happens to be <code class="inline-code">0</code>, the whole + fraction second part will be omitted. Also note that the + fraction seconds are always separated with a dot , not with + comma (to follow the Web conventions and XML Schema + time/dateTime canonical format).</p> + </li> + + <li> + <p><code class="inline-code">nz</code> (optional): <code class="inline-code">nz</code> + (like in <code class="inline-code">${foo?utc_local_nz}</code>) stands for + "no zone", which means that the time zone offset + (like <code class="inline-code">+02:00</code> or or <code class="inline-code">-04:30</code> + or <code class="inline-code">Z</code>) will not be displayed. If this part is + omitted (like in <code class="inline-code">${foo?utc_local}</code>) the zone + will be displayed, except in two cases:</p> + + <ul> + <li> + <p>If the value is a date (no time part) value (again, + ISO 8901 doesn't allow it then)</p> + </li> + + <li> + <p>If the value is a <code class="inline-code">java.sql.Time</code> and + the <code class="inline-code">incompatible_improvements</code> (often set + via the Java <code class="inline-code">Configuration</code> constructor + parameter) FreeMarker configuration setting is at least + 2.3.21 (or 2.3.24 when you are inside a string literal). + This is because most databases store time values that aren't + in any time zone, but just store hour, minute, second, and + decimal second field values, so showing the time zone + doesn't make sense.</p> + </li> + </ul> + + <p>Note that since FreeMarker 2.3.19, the offset always + contains the minutes for XML Schema date/time/dateTime format + compliance. (However, if you primarily generate for the XML + Schema format, use the xs format.)</p> + </li> + </ol></div> + + <p>Example:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#assign aDateTime = .now> +<#assign aDate = aDateTime?date> +<#assign aTime = aDateTime?time> + +Basic formats: +${aDate?iso_utc} +${aTime?iso_utc} +${aDateTime?iso_utc} + +Different accuracies: +${aTime?iso_utc_ms} +${aDateTime?iso_utc_m} + +Local time zone: +${aDateTime?iso_local}</pre></div> + + <p>A possible output (depends on current time and time + zone):</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">Basic formats: +2011-05-16 +21:32:13Z +2011-05-16T21:32:13Z + +Different accuracies: +21:32:13.868Z +2011-05-16T21:32Z + +Local time zone: +2011-05-16T23:32:13+02:00</pre></div> + + <p>There is yet another group of <code class="inline-code">iso_...</code> + built-in variants, where you omit the <code class="inline-code">local</code> or + <code class="inline-code">utc</code> word from the name and instead specify the + time zone as a parameter to the built-in. Example:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#assign aDateTime = .now> +${aDateTime?iso("UTC")} +${aDateTime?iso("GMT-02:30")} +${aDateTime?iso("Europe/Rome")} + +The usual variations are supported: +${aDateTime?iso_m("GMT+02")} +${aDateTime?iso_m_nz("GMT+02")} +${aDateTime?iso_nz("GMT+02")}</pre></div> + + <p>A possible output (depends on current time and time + zone):</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">2011-05-16T21:43:58Z +2011-05-16T19:13:58-02:30 +2011-05-16T23:43:58+02:00 + +The usual variations are supported: +2011-05-16T23:43+02:00 +2011-05-16T23:43 +2011-05-16T23:43:58</pre></div> + + <p>If the time zone parameter can't be interpreted, the template + processing will be terminated with error.</p> + + <p class="programmers-note">The parameter can be a + <code class="inline-code">java.util.TimeZone</code> object too (which is possibly + the return value of a Java method, or it's in the data-model), not + just a string.</p> + + + + + +<h2 class="content-header header-section2" id="ref_builtin_string_for_date">string (when used with a date/time/date-time value)</h2> + + + + + + + + + + + + + + + + + + + + + + + + + <p>This built-in converts a date to a string, with the specified + formatting.</p> + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>You should need this built-in rarely, as the default format + of date/time/date-time values can be specified globally <a href="ref_directive_setting.html#topic.dateTimeFormatSettings">with the + <code>date_format</code>, <code>time_format</code> and + <code>datetime_format</code> settings</a> of FreeMarker. + Use this built-in only at the places where the desired format + differs from the one normally used. For the other places the + default format should be set properly by the programmers, outside + the templates.</p> + </div> + + + <p>The desired format can be specified like + <code class="inline-code">?string.<em class="code-color">format</em></code> or + <code class="inline-code">?string["<em class="code-color">format</em>"]</code>(or + the historical equivalent, + <code class="inline-code">?string("<em class="code-color">format</em>")</code>). + These are equivalent, except that with the quoted formats you can + include any characters in the + <code class="inline-code"><em class="code-color">format</em></code>, like spaces. + The syntax of <code class="inline-code"><em class="code-color">format</em></code> + is exactly the same as of the <code class="inline-code">date_format</code>, + <code class="inline-code">time_format</code> and + <code class="inline-code">datetime_format</code> configuration settings; <a href="ref_directive_setting.html#topic.dateTimeFormatSettings">see the documentation of the + possible values there</a>.</p> + + <p>Example: If the locale of the output is U.S. English, and the + time zone is the U.S. Pacific Time zone, and + <code class="inline-code">openingTime</code> is a + <code class="inline-code">java.sql.Time</code>, <code class="inline-code">nextDiscountDay</code> + is <code class="inline-code">java.sql.Date</code> and + <code class="inline-code">lastUpdated</code> is + <code class="inline-code">java.sql.Timestamp</code> or + <code class="inline-code">java.util.Date</code> then this:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#-- Predefined format names: --> + +${openingTime?string.short} +${openingTime?string.medium} +${openingTime?string.long} +${openingTime?string.full} +${openingTime?string.xs} <#-- XSD xs:time --> +${openingTime?string.iso} <#-- ISO 8601 time --> + +${nextDiscountDay?string.short} +${nextDiscountDay?string.medium} +${nextDiscountDay?string.long} +${nextDiscountDay?string.full} +${nextDiscountDay?string.xs} <#-- XSD xs:date --> +${nextDiscountDay?string.iso} <#-- ISO 8601 date --> + +${lastUpdated?string.short} +${lastUpdated?string.medium} +${lastUpdated?string.long} +${lastUpdated?string.full} +${lastUpdated?string.medium_short} <#-- medium date, short time --> +${lastUpdated?string.xs} <#-- XSD xs:dateTime --> +${lastUpdated?string.iso} <#-- ISO 8601 combined date and time --> + +<#-- <a href="pgui_config_custom_formats.html">Programmer-defined named format</a> (@ + name): --> +${lastUpdated?string.@fileDate} + +<#-- Advanced ISO 8601 and XSD formatting: --> +${lastUpdated?string.iso_m_u} +${lastUpdated?string.xs_ms_nz} + +<#-- SimpleDateFormat patterns: --> +${lastUpdated?string["dd.MM.yyyy, HH:mm"]} +${lastUpdated?string["EEEE, MMMM dd, yyyy, hh:mm a '('zzz')'"]} +${lastUpdated?string["EEE, MMM d, ''yy"]} +${lastUpdated?string.yyyy} <#-- Same as ${lastUpdated?string["yyyy"]} --></pre></div> + + <p>will print something like this:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">01:45 PM +01:45:09 PM +01:45:09 PM PST +01:45:09 PM PST +13:45:09-08:00 +13:45:09-08:00 + +2/20/07 +Apr 20, 2007 +April 20, 2007 +Friday, April 20, 2007 +2007-02-20-08:00 +2007-02-20 + +2/20/07 01:45 PM +Feb 20, 2007 01:45:09 PM +February 20, 2007 01:45:09 PM PST +Friday, February 20, 2007 01:45:09 PM PST +Feb 8, 2003 9:24 PM +2007-02-20T13:45:09-08:00 +2007-02-20T13:45:09-08:00 + +Apr/20/2007 13:45 + +2007-02-20T21:45Z +2007-02-20T13:45:09.000 + +08.04.2003 21:24 +Tuesday, April 08, 2003, 09:24 PM (PDT) +Tue, Apr 8, '03 +2003</pre></div> + + <p>Note that with custom formats like in + <code class="inline-code">lastUpdated?string.@fileDate</code> above, templates can + just refer to the application-domain meaning, and the exact format + can be specified outside the templates, on a central place. + (Programmers can read about <a href="pgui_config_custom_formats.html">defining such named formats + here...</a>)</p> + + <div class="callout warning"> + <strong class="callout-label">Warning!</strong> + + <p>Unfortunately, because of the limitations of the Java + platform, it can happen that you have date-like variables in the + data-model, where FreeMarker can't decide if the variable is a + date (year, month, day), or a time (hour, minute, second, + millisecond) or a date-time. In this case, FreeMarker doesn't know + how to display the value when you write something like + <code class="inline-code">${lastUpdated?string.short}</code> or + <code class="inline-code">${lastUpdated?string.xs}</code>, i.e., a format that + doesn't specify the exact fields to display, or if you simply use + <code class="inline-code">${lastUpdated}</code>. Then it will have to stop with + error. To prevent this, you can help FreeMarker with the <a href="#ref_builtin_date_datetype"><code>?date</code>, + <code>?time</code> and <code>?datetime</code> + built-ins</a>. For example: + <code class="inline-code">${lastUpdated?datetime?string.short}</code>. Ask the + programmers if certain variables of the data-model have this + problem, or always use <code class="inline-code">?date</code>, + <code class="inline-code">?time</code> and <code class="inline-code">?datetime</code> + built-ins to be on the safe side.</p> + </div> + + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>You never need to use <code class="inline-code">?date</code>, + <code class="inline-code">?time</code> or <code class="inline-code">?datetime</code> with + format patterns like <code class="inline-code">"yyyy.MM.dd HH:mm"</code>, since + with the pattern you tell FreeMarker what parts of the date to + show. However, FreeMarker will trust you blindly, so you can show + "noise" if you display parts that are actually not stored in the + variable. For example, <code class="inline-code">${openingTime?string["yyyy-MM-dd + hh:mm:ss a"]}</code>, where <code class="inline-code">openingTime</code> + stores only time, will display <code class="inline-code">1970-01-01 09:24:44 + PM</code>.</p> + </div> + + + <p>To prevent misunderstandings, the format need not be a string + literal, it can be a variable or any other expression as far as it + evaluates to a string. For example, it can be like + <code class="inline-code">"<em class="code-color">...</em>"?string[myFormat]</code>.</p> + + <p>See also: <a href="dgui_template_valueinsertion.html#dgui_template_valueinserion_universal_date">the + interpolation of dates</a></p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_builtins_number.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_builtins_boolean.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html>
