Discussions

Web tier: servlets, JSP, Web frameworks: date format ?

  1. date format ? (1 messages)

    Hi, I am using Mysql database, in a table called history I have three fields (varchar(30), date, date) , the date format is 2000-02-14 , I want to create a form to insert current date in that format, how to do it ?
    thanks

    Threaded Messages (1)

  2. date format ?[ Go to top ]

    To format a date:
    SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");
    Date currentTime_1 = new Date();
    String dateString = formatter.format(currentTime_1);
    System.out.println("Date is:"+dateString);

    Hope this help