Mick,

You can refer following code but still you have to convert the type in the 
last because this method returns string.

  public static String addDaysToDate( String strDate, String noofDays,
                                      String dateFormat ) throws Exception
  {
    Calendar calendar = Calendar.getInstance();
    String str_dt = "";
    SimpleDateFormat formatter = new SimpleDateFormat( dateFormat );
    Date input_dt = formatter.parse( strDate );
    calendar.setTime( input_dt );
    calendar.add( Calendar.DATE, Integer.parseInt( noofDays ) );
    Date result_dt = calendar.getTime();
    str_dt = formatter.format( result_dt );
    return str_dt;
  }


Hope it helps
Sunil




Dave Newton <[EMAIL PROTECTED]> 
10/17/2005 11:37 PM
Please respond to
"Struts Users Mailing List" <user@struts.apache.org>


To
Struts Users Mailing List <user@struts.apache.org>
cc

Subject
Re: [ot]Date utilitiy to take date String, add a day, and return sql date?






Mick Knutson wrote:

>I need to see if anyone has a utility to take a String date, add 1 day,
>and return a java.sql.Date
> 
>
I'd probably check out the Calendar class.

Dave Newton
Technical Lead, MonkeyLips Omnigalgomon Project



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


Reply via email to