Convert date format

thumbnail
13006, modified 21 Years ago. Liferay Master Posts: 690 Join Date: 8/18/04 Recent Posts
Startdate <b>2004-11-01 00:00:00.0</b> this format i am getting from database and insertting well.<br /><br /><br />when i add no of days to that <br /><br />like this<br />Calendar sdate = new GregorianCalendar();<br /> sdate.setTime(startDate);<br /> bdMonth = ff21.get(Calendar.MONTH);<br /> bdYear = ff21.get(Calendar.YEAR);<br /> bdDay = ff21.get(Calendar.DATE);<br /> sdate.set(bdYear,bdMonth,bdDay);<br /> sdate.add(Calendar.DATE, noofdays);<br /><br /> bdMonth = sdate.get(Calendar.MONTH);<br /> bdYear = sdate.get(Calendar.YEAR);<br /> bdDay = sdate.get(Calendar.DATE);<br /> Date d = new GregorianCalendar(bdYear, bdMonth, bdDay).getTime();<br /><br /><b>Enddate Mon Sep 06 00:00:00 NZST 2004 </b><br />is comming like this and not storing database.<br />i changed using simple dateformat as<br />SimpleDateFormat df = new SimpleDateFormat( &quot;yyyy-MM-dd HH:mm:ss.S&quot; );<br /><br />endDate = df.format(d); <br />showing the error as<br /><br />found : java.lang.String<br />required: java.util.Date<br /><br />cheers<br /><br />
thumbnail
13006, modified 21 Years ago. Liferay Master Posts: 690 Join Date: 8/18/04 Recent Posts
sorry sorted it has to take in string.<br />cheers<br />bu one more doubt<br />if Date d = new GregorianCalendar(bdYear, bdMonth, bdDay).getTime();<br />i am getting like this format<br />Sun Oct 31 00:00:00 NZDT 2004 <br /> can i suppress the time ?<br /> <!--emo&emoticon--><img src='@theme_images_path@/emotions/huh.gif' border='0' style='vertical-align:middle' alt='huh.gif' /><!--endemo--> <br />
13086, modified 21 Years ago. Liferay Legend Posts: 1254 Join Date: 8/18/04 Recent Posts
The most appropriate place for this sort of question is probably <a href='http://developers.sun.com/forums/index.html' target='_blank'>http://developers.sun.com/forums/index.html</a> , as it is not really portal specific.
thumbnail
13006, modified 21 Years ago. Liferay Master Posts: 690 Join Date: 8/18/04 Recent Posts
ok got it<br />thanks