I want to convert time to hh:mm from hh:mm:ss it comes from database (my sql) in the form of hh:mm:ss. I tried the following code but i didn't get what i want.
try {
s= HibernateUtil.currentSession();
tx=s.beginTransaction();
Query query = s.createQuery("select from Dailytimesheet dailytimesheet where dailytimesheet.IdDailyTimeSheet=6083 " );
for(Iterator it=query.iterate();it.hasNext();)
{
if(it.hasNext())
{
Dailytimesheet object=(Dailytimesheet)it.next();
String dt=object.getTimeFrom().toString();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
long ms=0;
try {
ms = sdf.parse(dt).getTime();
}
catch (ParseException e) {e.printStackTrace();}
Time ts = new Time(ms);
out.println("<h2>"+ts+"</h2>");
thanks for your help.