Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: getting NaN/NaN/0NaN value instead of Date and time

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Location
    hyderabad
    Posts
    9
    My Mood
    Fine
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation getting NaN/NaN/0NaN value instead of Date and time

    Hi,

    This is VaniRathna i am very new to java. l have a Actionclass which displays the values from my data Base. i have a table with the name b_announcements and with the columns [ u_id,name,start_date,end_date,information,status ] for start_date,end_date i took data type as time stamp with time zone but when i am trying to display them in grid they are displaying like NaN/NaN/0NaN how can i resolve this my code is like this

    /**
     * Displays announce in grid
     */
    package com.codon;
     
    import java.io.Reader;
    import java.text.DateFormat;
    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.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");
    		Reader reader=Resources.getResourceAsReader("Xml/SqlMapConfig.xml");
    		SqlMapClient sqlMap=SqlMapClientBuilder.buildSqlMapClient(reader);
    		ArrayList list=(ArrayList)sqlMap.queryForList("announcedetails",null);
    		Iterator itr=list.iterator();
    		DateFormat formatter;
    		formatter = new SimpleDateFormat("yyyy/MM/DD");
     
    		sos.println("<dataset>");
    		while(itr.hasNext())
    		{
    			B_Announce element=(B_Announce)itr.next();
    			sos.println("<item>");
    		  	sos.println("<announce_id>"+element.getAnnounce_id()+"</announce_id>");	
    		  	sos.println("<name>"+element.getName()+"</name>");	
    		  	sos.println("<start_date>"+element.getStart_date()+"</start_date>");	
    		  	sos.println("<end_date>"+element.getEnd_date()+"</end_date>");	
    		  	sos.println("<information>"+element.getInformation()+"</information>");	
    		  	sos.println("<active>"+element.getActive()+"</active>");	
    		  	//sos.println("<checked_out>"+element.getChecked_out()+"</checked_out>");
    		  	sos.println("</item>");
    		}//while
    		sos.println("</dataset>");
    		}catch(Exception e)
    		{
    			e.printStackTrace();
    		}
    		return null;
    	}//execute
    }


    thank you for any help


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,438
    My Mood
    Hungover
    Thanks
    144
    Thanked 634 Times in 542 Posts

    Default Re: getting NaN/NaN/0NaN value instead of Date and time

    I am moving this to a more appropriate forum. The Member Introductions forum is not for technical questions.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,438
    My Mood
    Hungover
    Thanks
    144
    Thanked 634 Times in 542 Posts

    Default Re: getting NaN/NaN/0NaN value instead of Date and time

    Also, please don't spam post multiple copies of the same question. I've deleted your duplicate thread.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. The Following User Says Thank You to KevinWorkman For This Useful Post:

    VaniRathna (October 24th, 2011)

  5. #4
    Junior Member
    Join Date
    Oct 2011
    Location
    hyderabad
    Posts
    9
    My Mood
    Fine
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: getting NaN/NaN/0NaN value instead of Date and time

    Hi,

    Thank you. Actually iam very new to this. and also i have some English problem please help me if i do any mistakes
    VaniRathna

Similar Threads

  1. Replies: 1
    Last Post: July 22nd, 2011, 07:08 AM
  2. [SOLVED] how to get phone time and date
    By mahdi in forum Java ME (Mobile Edition)
    Replies: 2
    Last Post: August 26th, 2009, 11:15 AM
  3. How to Get the current date and time
    By JavaPF in forum Java Programming Tutorials
    Replies: 2
    Last Post: December 2nd, 2008, 12:55 PM
  4. How to Get the current date and time
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 2
    Last Post: December 2nd, 2008, 12:55 PM