You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by deligeli <od...@jpost.com> on 2008/06/22 14:19:37 UTC
using date
HI!
I need to get the current month and year.
What's the way to get it in velocity?
--
View this message in context: http://www.nabble.com/using-date-tp18054049p18054049.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: using date
Posted by Abrami Avi <Av...@comverse.com>.
Use the date tools that the other poster mentioned.
-----Original Message-----
From: deligeli [mailto:odelya@jpost.com]
Sent: Monday, June 23, 2008 9:14 AM
To: user@velocity.apache.org
Subject: RE: using date
i don't use any java code - i use only templates...
what is the java class and how do i change it?
Abrami Avi wrote:
>
> In your java code, put something similar to:
>
> VelocityContext vc = new VelocityContext(); vc.put("clndr",
> Calendar.getInstance());
>
> And in your template file (usually HTML or XML), you would have:
>
> $clndr.get(Calendar.MONTH);
>
> But that will only give you the integer representation of the month,
> not the actual month name.
> How did you want to show the current month?
> Did you want to display the name of the month, for example, "July"?
>
> -----Original Message-----
> From: deligeli [mailto:odelya@jpost.com]
> Sent: Sunday, June 22, 2008 5:50 PM
> To: user@velocity.apache.org
> Subject: RE: using date
>
>
> I have a code, where i want to show the current month.
> is there a funtion like $month or $Calendar.get(Calendar.MONTH)?
>
> Thanks
>
> Abrami Avi wrote:
>>
>> Your question is vague and therefore open to interpretation.
>> Malcolm is referring to the class
> "org.apache.velocity.VelocityContext".
>> You don't get the current month and year in Velocity, you get it from
>> the core java classes.
>> Specifically the "java.util.Calendar" class.
>>
>> Perhaps you can provide more details, preferrably the relevant part
>> of
>
>> your code.
>>
>> Good Luck!
>>
>> -----Original Message-----
>> From: deligeli [mailto:odelya@jpost.com]
>> Sent: Sunday, June 22, 2008 5:30 PM
>> To: user@velocity.apache.org
>> Subject: Re: using date
>>
>>
>> how do i do it?
>> where is the VelocityContext located?
>>
>> Malcolm Edgar-2 wrote:
>>>
>>> You need to add it to the VelocityContext model so you can access it
>>> in the template.
>>>
>>> regards Malcolm Edgar
>>>
>>> On Sun, Jun 22, 2008 at 10:19 PM, deligeli <od...@jpost.com> wrote:
>>>>
>>>> HI!
>>>> I need to get the current month and year.
>>>>
>>>> What's the way to get it in velocity?
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/using-date-tp18054049p18054049.html
>>>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -------------------------------------------------------------------
>>>> -
>>>> - To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>>
>>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/using-date-tp18054049p18055071.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/using-date-tp18054049p18055239.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
--
View this message in context:
http://www.nabble.com/using-date-tp18054049p18063166.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: using date
Posted by deligeli <od...@jpost.com>.
i don't use any java code - i use only templates...
what is the java class and how do i change it?
Abrami Avi wrote:
>
> In your java code, put something similar to:
>
> VelocityContext vc = new VelocityContext();
> vc.put("clndr", Calendar.getInstance());
>
> And in your template file (usually HTML or XML), you would have:
>
> $clndr.get(Calendar.MONTH);
>
> But that will only give you the integer representation of the month, not
> the actual month name.
> How did you want to show the current month?
> Did you want to display the name of the month, for example, "July"?
>
> -----Original Message-----
> From: deligeli [mailto:odelya@jpost.com]
> Sent: Sunday, June 22, 2008 5:50 PM
> To: user@velocity.apache.org
> Subject: RE: using date
>
>
> I have a code, where i want to show the current month.
> is there a funtion like $month or $Calendar.get(Calendar.MONTH)?
>
> Thanks
>
> Abrami Avi wrote:
>>
>> Your question is vague and therefore open to interpretation.
>> Malcolm is referring to the class
> "org.apache.velocity.VelocityContext".
>> You don't get the current month and year in Velocity, you get it from
>> the core java classes.
>> Specifically the "java.util.Calendar" class.
>>
>> Perhaps you can provide more details, preferrably the relevant part of
>
>> your code.
>>
>> Good Luck!
>>
>> -----Original Message-----
>> From: deligeli [mailto:odelya@jpost.com]
>> Sent: Sunday, June 22, 2008 5:30 PM
>> To: user@velocity.apache.org
>> Subject: Re: using date
>>
>>
>> how do i do it?
>> where is the VelocityContext located?
>>
>> Malcolm Edgar-2 wrote:
>>>
>>> You need to add it to the VelocityContext model so you can access it
>>> in the template.
>>>
>>> regards Malcolm Edgar
>>>
>>> On Sun, Jun 22, 2008 at 10:19 PM, deligeli <od...@jpost.com> wrote:
>>>>
>>>> HI!
>>>> I need to get the current month and year.
>>>>
>>>> What's the way to get it in velocity?
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/using-date-tp18054049p18054049.html
>>>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> --------------------------------------------------------------------
>>>> - To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/using-date-tp18054049p18055071.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/using-date-tp18054049p18055239.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/using-date-tp18054049p18063166.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: using date
Posted by Steve O'Hara <so...@pivotal-solutions.co.uk>.
A better way to handle Date is by adding the DateTool
(http://velocity.apache.org/tools/releases/1.4/generic/) to your context
either manually or automatically via the toolbox.
Gives you date parsing and formatting methods as well as getting the
current date.
Steve
-----Original Message-----
From:
user-return-19894-sohara=pivotal-solutions.co.uk@velocity.apache.org
[mailto:user-return-19894-sohara=pivotal-solutions.co.uk@velocity.apache
.org] On Behalf Of Abrami Avi
Sent: 22 June 2008 18:16
To: Velocity Users List
Subject: RE: using date
In your java code, put something similar to:
VelocityContext vc = new VelocityContext();
vc.put("clndr", Calendar.getInstance());
And in your template file (usually HTML or XML), you would have:
$clndr.get(Calendar.MONTH);
But that will only give you the integer representation of the month, not
the actual month name.
How did you want to show the current month?
Did you want to display the name of the month, for example, "July"?
-----Original Message-----
From: deligeli [mailto:odelya@jpost.com]
Sent: Sunday, June 22, 2008 5:50 PM
To: user@velocity.apache.org
Subject: RE: using date
I have a code, where i want to show the current month.
is there a funtion like $month or $Calendar.get(Calendar.MONTH)?
Thanks
Abrami Avi wrote:
>
> Your question is vague and therefore open to interpretation.
> Malcolm is referring to the class
"org.apache.velocity.VelocityContext".
> You don't get the current month and year in Velocity, you get it from
> the core java classes.
> Specifically the "java.util.Calendar" class.
>
> Perhaps you can provide more details, preferrably the relevant part of
> your code.
>
> Good Luck!
>
> -----Original Message-----
> From: deligeli [mailto:odelya@jpost.com]
> Sent: Sunday, June 22, 2008 5:30 PM
> To: user@velocity.apache.org
> Subject: Re: using date
>
>
> how do i do it?
> where is the VelocityContext located?
>
> Malcolm Edgar-2 wrote:
>>
>> You need to add it to the VelocityContext model so you can access it
>> in the template.
>>
>> regards Malcolm Edgar
>>
>> On Sun, Jun 22, 2008 at 10:19 PM, deligeli <od...@jpost.com> wrote:
>>>
>>> HI!
>>> I need to get the current month and year.
>>>
>>> What's the way to get it in velocity?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/using-date-tp18054049p18054049.html
>>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/using-date-tp18054049p18055071.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
--
View this message in context:
http://www.nabble.com/using-date-tp18054049p18055239.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: using date
Posted by Abrami Avi <Av...@comverse.com>.
In your java code, put something similar to:
VelocityContext vc = new VelocityContext();
vc.put("clndr", Calendar.getInstance());
And in your template file (usually HTML or XML), you would have:
$clndr.get(Calendar.MONTH);
But that will only give you the integer representation of the month, not
the actual month name.
How did you want to show the current month?
Did you want to display the name of the month, for example, "July"?
-----Original Message-----
From: deligeli [mailto:odelya@jpost.com]
Sent: Sunday, June 22, 2008 5:50 PM
To: user@velocity.apache.org
Subject: RE: using date
I have a code, where i want to show the current month.
is there a funtion like $month or $Calendar.get(Calendar.MONTH)?
Thanks
Abrami Avi wrote:
>
> Your question is vague and therefore open to interpretation.
> Malcolm is referring to the class
"org.apache.velocity.VelocityContext".
> You don't get the current month and year in Velocity, you get it from
> the core java classes.
> Specifically the "java.util.Calendar" class.
>
> Perhaps you can provide more details, preferrably the relevant part of
> your code.
>
> Good Luck!
>
> -----Original Message-----
> From: deligeli [mailto:odelya@jpost.com]
> Sent: Sunday, June 22, 2008 5:30 PM
> To: user@velocity.apache.org
> Subject: Re: using date
>
>
> how do i do it?
> where is the VelocityContext located?
>
> Malcolm Edgar-2 wrote:
>>
>> You need to add it to the VelocityContext model so you can access it
>> in the template.
>>
>> regards Malcolm Edgar
>>
>> On Sun, Jun 22, 2008 at 10:19 PM, deligeli <od...@jpost.com> wrote:
>>>
>>> HI!
>>> I need to get the current month and year.
>>>
>>> What's the way to get it in velocity?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/using-date-tp18054049p18054049.html
>>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/using-date-tp18054049p18055071.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
--
View this message in context:
http://www.nabble.com/using-date-tp18054049p18055239.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: using date
Posted by deligeli <od...@jpost.com>.
I have a code, where i want to show the current month.
is there a funtion like $month or $Calendar.get(Calendar.MONTH)?
Thanks
Abrami Avi wrote:
>
> Your question is vague and therefore open to interpretation.
> Malcolm is referring to the class "org.apache.velocity.VelocityContext".
> You don't get the current month and year in Velocity, you get it from
> the core java classes.
> Specifically the "java.util.Calendar" class.
>
> Perhaps you can provide more details, preferrably the relevant part of
> your code.
>
> Good Luck!
>
> -----Original Message-----
> From: deligeli [mailto:odelya@jpost.com]
> Sent: Sunday, June 22, 2008 5:30 PM
> To: user@velocity.apache.org
> Subject: Re: using date
>
>
> how do i do it?
> where is the VelocityContext located?
>
> Malcolm Edgar-2 wrote:
>>
>> You need to add it to the VelocityContext model so you can access it
>> in the template.
>>
>> regards Malcolm Edgar
>>
>> On Sun, Jun 22, 2008 at 10:19 PM, deligeli <od...@jpost.com> wrote:
>>>
>>> HI!
>>> I need to get the current month and year.
>>>
>>> What's the way to get it in velocity?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/using-date-tp18054049p18054049.html
>>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/using-date-tp18054049p18055071.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/using-date-tp18054049p18055239.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
RE: using date
Posted by Abrami Avi <Av...@comverse.com>.
Your question is vague and therefore open to interpretation.
Malcolm is referring to the class "org.apache.velocity.VelocityContext".
You don't get the current month and year in Velocity, you get it from
the core java classes.
Specifically the "java.util.Calendar" class.
Perhaps you can provide more details, preferrably the relevant part of
your code.
Good Luck!
-----Original Message-----
From: deligeli [mailto:odelya@jpost.com]
Sent: Sunday, June 22, 2008 5:30 PM
To: user@velocity.apache.org
Subject: Re: using date
how do i do it?
where is the VelocityContext located?
Malcolm Edgar-2 wrote:
>
> You need to add it to the VelocityContext model so you can access it
> in the template.
>
> regards Malcolm Edgar
>
> On Sun, Jun 22, 2008 at 10:19 PM, deligeli <od...@jpost.com> wrote:
>>
>> HI!
>> I need to get the current month and year.
>>
>> What's the way to get it in velocity?
>> --
>> View this message in context:
>> http://www.nabble.com/using-date-tp18054049p18054049.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
--
View this message in context:
http://www.nabble.com/using-date-tp18054049p18055071.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: using date
Posted by deligeli <od...@jpost.com>.
how do i do it?
where is the VelocityContext located?
Malcolm Edgar-2 wrote:
>
> You need to add it to the VelocityContext model so you can access it
> in the template.
>
> regards Malcolm Edgar
>
> On Sun, Jun 22, 2008 at 10:19 PM, deligeli <od...@jpost.com> wrote:
>>
>> HI!
>> I need to get the current month and year.
>>
>> What's the way to get it in velocity?
>> --
>> View this message in context:
>> http://www.nabble.com/using-date-tp18054049p18054049.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/using-date-tp18054049p18055071.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: using date
Posted by Malcolm Edgar <ma...@gmail.com>.
You need to add it to the VelocityContext model so you can access it
in the template.
regards Malcolm Edgar
On Sun, Jun 22, 2008 at 10:19 PM, deligeli <od...@jpost.com> wrote:
>
> HI!
> I need to get the current month and year.
>
> What's the way to get it in velocity?
> --
> View this message in context: http://www.nabble.com/using-date-tp18054049p18054049.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org