Re: Survey: How ISO 8601 date formatting should work in FreeMarker 2.3.17

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user,gmane.comp.web.freemarker.devel
Message-ID <[email protected]>
OK, there's one change already: Unless I'm blind, ISO 8601:2004
doesn't allow offset (time zone) after a pure date. So there won't be
2010-05-09Z, only 2010-05-09. Which strikes me as silly (because,
2010-05-09 in which time zone?)... but, what can I do.


Monday, May 9, 2011, 6:39:51 PM, Daniel Dekany wrote:

> The factors I'm not 100% sure about is:
> - Using UTC VS local time zone
> - Printing the time zone offset (including "Z") or not
>
> The current plan is that if you have:
>
>   ${exp?iso_utc}
>
> Then, depending on the type of the expression value:
> - If it's a date-only value, it prints something like
>   2010-05-09Z
> - If it's a time-only value, it prints something like
>   18:15:16Z
>   or if the millisec part is not 0 then:
>   18:15:16.008Z
> - If it's a date-time value then it's like:
>   2010-05-09T18:15:16Z
>   or
>   2010-05-09T18:15:16.008Z
> - If it's not decided if which parts of the date is used (like if you drop
>   a java.util.Date into the data-model), then just like with non-ISO
>   formatting, the above will be an error, and you have to write something
>   like:
>   ${exp?date?iso_utc}
>   ${exp?time?iso_utc}
>   ${exp?datetime?iso_utc}
>
> So as you can see:
> - The time zone is always UTC
> - The offset is always shown ("Z", since it's UTC), even for
>   date-only values.
>
> If you want to print with the local time zone (which is decided by the
> "time_zone" setting of FreeMarker), then you have to write:
>
>   ${exp?iso_local}
>
> In this case instead of "Z" you will get an offset like ("+05:00").
> The offset would be always shown here too.
>
> If you don't want to show the offset then you had to write:
>
>   ${exp?iso_utc_no}
>
> or
>
>   ${exp?iso_local_no}
>
> where "no" stands for "No Offset". /-:
>
> Opinions?
>

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.