0

how to change datetime to string from sql?

asked 2013-07-17 08:50:34 +0800

susu gravatar image susu
11 2

updated 2013-07-17 11:48:33 +0800

hswain gravatar image hswain flag of India
1763 3 10
http://corejavaexample.bl...
private void jInit() throws Exception
    {
        datalogSQL = new DatalogSQL();
        MaintMode = (String) this.arg.get(ZkConstants.MaintMode);
        if (MaintMode != null && 
                (MaintMode.equals(ZkConstants.MaintModeEdit)
                        || MaintMode.equals(ZkConstants.MaintModeView)))
        {
            if (DAT_DATE.getValue() != null)
              {
               SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

               String strDate = sdf.format(dbxEVT_DATE.getValue());

               hParam.putString("EVT_DATE",strDate); 
              }     
            //datalogSQL.setDAT_DATE((String)arg.get("DAT_DATE"));
            datalogSQL.setDAT_TABLE((String)arg.get("DAT_TABLE"));
            datalogSQL.setDAT_SOURCE((String)arg.get("DAT_SOURCE"));
            datalogSQL.setDAT_MSG1((String)arg.get("DAT_MSG1"));
            datalogSQL.setDAT_TYPE((String)arg.get("DAT_TYPE"));

            if (datalogSQL.getByKey() == 0)
            {
                //ZkGuiUtil.showInformation(PageUtil.getPrompt("Record does not exist"));
            }

        }
    }
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-07-17 11:45:08 +0800

iamsudhir4u gravatar image iamsudhir4u flag of India
545 7
http://corejavasupport.bl...

I think this will be help full for you.

DateTime dateTime = new DateTime();
String strDateTime = dateTime.toString("yyyy-mm-dd hh:mm:ss");
System.out.println(strDateTime);

Output: 2013-11-17 04:11:08

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2013-07-17 08:50:34 +0800

Seen: 14 times

Last updated: Jul 17 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More