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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Daniel Dekany
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
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: [FreeMarker-user] Survey: How ISO 8601 date formatting should work in FreeMarker 2.3.17

Daniel Dekany
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
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: [FreeMarker-user] Survey: How ISO 8601 date formatting should work in FreeMarker 2.3.17

Denis Bredelet

> 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.

It is not silly. Think about it, can you offset 2 hours from a pure date? A date is not linked to a timezone unless you attach a time to it.

I think iso_utc and iso_local are fine. A suggestion would be to allow specifying a timezone for iso_local.

-- Denis.

>
>
> 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
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel

------------------------------------------------------------------------------
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
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: [FreeMarker-user] Survey: How ISO 8601 date formatting should work in FreeMarker 2.3.17

Daniel Dekany
Monday, May 9, 2011, 10:58:33 PM, Denis Bredelet wrote:

>> 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.
>
> It is not silly. Think about it, can you offset 2 hours from a pure
> date? A date is not linked to a timezone unless you attach a time to it.

A pure date, like 2010-05-09 represents a 24 hours long section of
time. The beginning and ending of that section depends on the time
offset, since days start and end at different points of physical time
in different time zones. Like 2010-05-09 in New York starts and ends 6
hours later than in Budapest. From another point of view, you can omit
the seconds from a date-time if you don't need that much precision,
then even the minutes, and you still need to know the local offset. So
why's that need suddenly gone when you omit the hours too? It's just
decreasing the resolution, nothing else.

> I think iso_utc and iso_local are fine. A suggestion would be to
> allow specifying a timezone for iso_local.

Good point. So you can write both ${exp?iso_local} or
${exp?iso_local(tz)}.

> -- Denis.
>
>>
>>
>> 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
>> _______________________________________________
>> FreeMarker-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>
> ------------------------------------------------------------------------------
> 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
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel