You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mick Knutson <mi...@safeway.com> on 2005/10/17 19:36:26 UTC

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

I need to see if anyone has a utility to take a String date, add 1 day,
and return a java.sql.Date


--

Thanks
Mick Knutson
(925) 951-4126
HP Consulting Services
Safeway (Blackhawk Fastword Project)
J2EE Architect
---



"MMS <safeway.com>" made the following annotations.
------------------------------------------------------------------------------
Warning: 
All e-mail sent to this address will be received by the Safeway corporate e-mail system, and is subject to archival and review by someone other than the recipient.  This e-mail may contain information proprietary to Safeway and is intended only for the use of the intended recipient(s).  If the reader of this message is not the intended recipient(s), you are notified that you have received this message in error and that any review, dissemination, distribution or copying of this message is strictly prohibited.  If you have received this message in error, please notify the sender immediately. 
  
==============================================================================


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


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

Posted by Su...@Keane.com.
noofDays is the Number of days which you want to add in the date.



Laurie Harper <la...@holoweb.net> 
Sent by: news <ne...@sea.gmane.org>
10/18/2005 10:33 AM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>


To
user@struts.apache.org
cc

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






Sunil_Sahu@Keane.com wrote:
> [...]
>   public static String addDaysToDate( String strDate, String noofDays,
>                                       String dateFormat ) throws 
Exception

noofDays? What are those? Days 30 minutes offset from everywhere else? ;-)

L.


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



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

Posted by Laurie Harper <la...@holoweb.net>.
Sunil_Sahu@Keane.com wrote:
> [...]
>   public static String addDaysToDate( String strDate, String noofDays,
>                                       String dateFormat ) throws Exception

noofDays? What are those? Days 30 minutes offset from everywhere else? ;-)

L.


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


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

Posted by Su...@Keane.com.
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 <ne...@pingsite.com> 
10/17/2005 11:37 PM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>


To
Struts Users Mailing List <us...@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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



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

Posted by Dave Newton <ne...@pingsite.com>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org