Java/Apache Velocity date.format giving wrong year -
Java/Apache Velocity date.format giving wrong year -
i using next line of code in .vm files. particular date expect date returned 12/31/14, instead returning 12/31/15. know causing year come wrong?
$date.format('mm/dd/yy', 'wed dec 31 07:23:45 cst 2014')
in tools.xml file, have added comparisondatetool seen below:
<tool class="org.apache.velocity.tools.generic.comparisondatetool" format="mm/dd/yyyy h:m:s" depth="1" skip="month,week" bundle="org.apache.velocity.tools.generic.times" timezone="cst"/>
change format 'mm/dd/yy' (note lowercase y's)
yy (capital y) week year
the first week of calendar year earliest 7 day period starting on getfirstdayofweek() contains @ to the lowest degree getminimaldaysinfirstweek() days year. depends on values of getminimaldaysinfirstweek(), getfirstdayofweek(), , day of week of jan 1. weeks between week 1 of 1 year , week 1 of next year (exclusive) numbered sequentially 2 52 or 53 (except year(s) involved in julian-gregorian transition).
....
all weeks between first , lastly weeks (inclusive) have same week year value. therefore, first , lastly days of week year may have different calendar year values. ... example, jan 1, 1998 thursday. if getfirstdayofweek() mon , getminimaldaysinfirstweek() 4 (iso 8601 standard compatible setting), week 1 of 1998 starts on dec 29, 1997, , ends on jan 4, 1998. week year 1998 lastly 3 days of calendar year 1997. if, however, getfirstdayofweek() sunday, week 1 of 1998 starts on jan 4, 1998, , ends on jan 10, 1998; first 3 days of 1998 part of week 53 of 1997 , week year 1997.
java date-format velocity
Comments
Post a Comment