Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Convert date format
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( "yyyy-MM-dd HH:mm:ss.S" );<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 />
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&
--><img src='@theme_images_path@/emotions/huh.gif' border='0' style='vertical-align:middle' alt='huh.gif' /><!--endemo--> <br />
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.
ok got it<br />thanks
Community
Company
Feedback