user defined date format
by rajesh[ Edit ] 2009-12-30 16:27:10
Printing java date and time in user different format:
We have to use SimpleDateFormat to do this..
Example Code:
    import java.util.Date;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    public String getDateTime() {
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date();
        return dateFormat.format(date);
    }