aron.elston

problems with gel:dateFormat

Discussion created by aron.elston on Oct 12, 2010
Latest reply on Oct 12, 2010 by aron.elston
This is actually part of a process I'm writing that is much bigger, but if somebody can answer this question, then I'll be able to create the process I need. I figured this would be more straightforward and can be tested on a gel console very easily. So, I've written the following gel script:

<gel:script xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"



xmlns:sql="jelly:sql"



xmlns:core="jelly:core">
<core:set var="DayOfWeek">

<gel:formatDate format="EEE"/>
</core:set>
<core:set var="TodaysDate">

<gel:formatDate format="MM/dd/yyyy"/>
</core:set>




<core:if test='${DayOfWeek == "Mon"}'>



<core:set var="DayNumber" value="0"/>


</core:if>


<core:if test='${DayOfWeek == "Tue"}'>



<core:set var="DayNumber" value="1"/>


</core:if>


<core:if test='${DayOfWeek == "Wed"}'>



<core:set var="DayNumber" value="2"/>


</core:if>


<core:if test='${DayOfWeek == "Thu"}'>



<core:set var="DayNumber" value="3"/>


</core:if>


<core:if test='${DayOfWeek == "Fri"}'>



<core:set var="DayNumber" value="4"/>


</core:if>


<core:if test='${DayOfWeek == "Sat"}'>



<core:set var="DayNumber" value="5"/>


</core:if>


<core:if test='${DayOfWeek == "Sun"}'>



<core:set var="DayNumber" value="6"/>


</core:if>
<core:set var="MondayDate">

${TodaysDate} - ${DayNumber}
</core:set>
<gel:out> Today is ${DayOfWeek}, ${TodaysDate} which is ${DayNumber} Days from Monday, ${MondayDate}.
</gel:out>
</gel:script>

When I run this I get the following output:

C:\bat>gel parsedate.xml
Today is Wed, 05/26/2010 which is 2 Days from Monday, 05/26/2010 - 2.

What I want to get is this:
C:\bat>gel parsedate.xml
Today is Wed, 05/26/2010 which is 2 Days from Monday, [color=#FA194E]05/24/2010[color].

So bascially what I need to know is how I can use a gel script to compute a date by subtracting a value from another date. Thanks!

Outcomes