I haven't used the DateTool. I have my own Formatter class that formats date 
as well as other stuff. A code snippet is as follows:

import java.text.SimpleDateFormat;

//format a date object to dd/MM/yyyy date string
java.util.Date value = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String dateStr = sdf.format(value)

// format a date string to Date object
String dateStr = "23/09/2004";
Date theDate = null;
try
{
   SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
   sdf.setLenient(false);
   theDate = sdf.parse(dateStr);
}
catch (Exception e)
{
   // the string is not a date
}

Jian

>===== Original Message From "john mahan" <[EMAIL PROTECTED]> =====
>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.
>
>Cannot find any coding examples. Can anyone show me a few code lines to help 
me?
>
>THX



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to