Daniel Dekany
2011-05-09 16:39:51 UTC
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?
- 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
Best regards,
Daniel Dekany