new SimpleDateFormat('hh:mm:ss') : SimpleDateFormat « java.text « Java by API






new SimpleDateFormat('hh:mm:ss')

 
/*
 * Output:
11:27:37
28 Apr 2006 11:27:37 PDT
Fri Apr 28 2006
 */

import java.text.SimpleDateFormat;
import java.util.Date;

public class MainClass {
  public static void main(String args[]) {
    Date date = new Date();
    SimpleDateFormat sdf;
    sdf = new SimpleDateFormat("hh:mm:ss");
    System.out.println(sdf.format(date));
    sdf = new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz");
    System.out.println(sdf.format(date));
    sdf = new SimpleDateFormat("E MMM dd yyyy");
    System.out.println(sdf.format(date));
  }
}

           
         
  








Related examples in the same category

1.new SimpleDateFormat('dd MMM yyyy hh:mm:ss zzz')
2.new SimpleDateFormat('E MMM dd yyyy')
3.new SimpleDateFormat('yyyy-MM-dd')
4.new SimpleDateFormat(String pattern, Locale locale)
5.SimpleDateFormat: applyPattern(String pattern)
6.SimpleDateFormat: format(Date d)
7.SimpleDateFormat: parse(String text, ParsePosition pos)
8.SimpleDateFormat: setDateFormatSymbols(DateFormatSymbols newFormatSymbols)