You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by john mahan <jo...@isg.com> on 2004/10/25 23:49:14 UTC

Re: Velocity DateTool Coding Examples--OK

Shinobu (et al),
I was able to get it working when I went to get you an example of the
coding.
I discovered that the DateTool code needed to be included into a #Set().
In case another newbie is as retarded as I am here's the code I used:

#set ($priorDate = $shoppingCartItem.priorDate)  ## prior Cart Date
#set ($datePick = $date.format('M/d/yyyy',$priorDate)) ## Cart Date
Converted to Short String

If this is not correct or if there is a better way please advise.

Additionally, of course the DateTool utility code and XML settings must be
included (which is what I thought was my problem earlier)
Thanks for the response... I'm sure I'll be back with other things as I
progress my Velocity work.

FYI, I'm finding the Mailing List very helpful because it allows me to learn
from others about things that may be useful in the future.
Regards,
John Mahan

----- Original Message ----- 
From: "Shinobu Kawai" <sh...@gmail.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Saturday, October 23, 2004 9:41 AM
Subject: Re: Velocity DateTool Coding Examples


> hi john,
>
> > I'm a Velocity newbie and have not been able to use the DateTool
properly. I understand the methods but have not been successful coding them
so they render properly in the Template. Need to convert a Date object to a
string DD/MM/YYYY for display and convert a String object DD/MM/YYYY to Date
object.
> What have you tried?  What did you expect?  What did you actually get?
>
> > Cannot find any coding examples. Can anyone show me a few code lines to
help me?
>
http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/generic/DateTool.html
>
> Best regards,
> -- Shinobu Kawai
>
> -- 
> Shinobu Kawai <sh...@gmail.com>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity DateTool Coding Examples--OK

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi John,

> I discovered that the DateTool code needed to be included into a #Set().
> In case another newbie is as retarded as I am here's the code I used:
> 
> #set ($priorDate = $shoppingCartItem.priorDate)  ## prior Cart Date
> #set ($datePick = $date.format('M/d/yyyy',$priorDate)) ## Cart Date
> Converted to Short String
> 
> If this is not correct or if there is a better way please advise.
Well, it doesn't have to be in a #set directive, but if you are going
to reuse the output, it's sure a good practice.  ;)

> FYI, I'm finding the Mailing List very helpful because it allows me to learn
> from others about things that may be useful in the future.
Nice to hear that!

Best regards,
-- Shinobu Kawai

-- 
Shinobu Kawai <sh...@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org