A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
RabbitMQ in Depth
this week in the
Swing / AWT / SWT
Joined: Jul 21, 2006
Aug 21, 2006 23:35:00
date = new
is there any way to add n days in above variable
private String date=22 aug 2006
if i add 7 days to it ,it becomes
date=29 aug 2006
is ther any way to convert string into date please help by giving example if possible.
thanks in advance.
Joined: Jun 09, 2003
Aug 22, 2006 13:47:00
> is there any way to add n days in above variable
create a new Date out of the current Date's milliseconds + n*(milliseconds in a day).
but this is a real 'hack'.
better to create a calendar object, add 7 days, then format calendar.getTime()
Joined: Aug 17, 2006
Aug 22, 2006 14:25:00
conversion from String to Date and vice versa is done using the class
, which is in the java.text package. You can search on it in google and find Suns javadoc page which is an excellent reference on how to use it.
I agree. Here's the link:
subject: date problem
How to Manipulate Dates?
Swing Multiple Window
Woa! Why does Date/Calendar do this?
Stumped By HashSet
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015