hi all,
this is vanirathna,
i have a table in db with the name b_announcements in that i took start_date,end_date fields with time stamp with time zone, i am trying to store values to that fields by a (extjs) form but they are storing in "2011-10-16 00:00:00+05:30" this format, time is not storing.when i am trying to display in the grid also same thing happening, i used
/** * Displays announce in grid */ package com.codon.action; import java.io.Reader; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Iterator; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.codon.bean.B_Announcements; import com.codon.logic.Db_connect; import com.ibatis.common.resources.Resources; import com.ibatis.sqlmap.client.SqlMapClient; import com.ibatis.sqlmap.client.SqlMapClientBuilder; public class ShowAnnounce extends Action{ private final String SUCCESS="success.jsp"; public ActionForward execute(ActionMapping mapping,ActionForm form, HttpServletRequest request,HttpServletResponse response) throws Exception { try{ ServletOutputStream sos=response.getOutputStream(); response.setHeader("Cache-Control","no-store"); response.setHeader("Pragma","no-cache"); response.setContentType("text/xml"); SqlMapClient sqlMap=Db_connect.sqlMap; ArrayList list=(ArrayList)sqlMap.queryForList("announcedetails",null); Iterator itr=list.iterator(); sos.println("<dataset>"); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); while(itr.hasNext()) { B_Announcements element=(B_Announcements)itr.next(); sos.println("<item>"); sos.println("<announce_id>"+element.getAnnounce_id()+"</announce_id>"); sos.println("<name>"+element.getName()+"</name>"); sos.println("<start_date>"+sdf.parse(element.getStart_date())+"</start_date>"); sos.println("<end_date>"+sdf.parse(element.getEnd_date())+"</end_date>"); sos.println("<information>"+element.getInformation()+"</information>"); sos.println("<active>"+element.getActive()+"</active>"); sos.println("</item>"); }//while sos.println("</dataset>"); }catch(Exception e) { e.printStackTrace(); } return null; }//execute }
please help me..
thanks in adv..