Java SimpleDateFormat format Date to String as "09.57.36"

Description

Java SimpleDateFormat format Date to String as "09.57.36"

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

public class Main {

  static public void main(String[] args) {
    SimpleDateFormat formatter = new SimpleDateFormat("HH.mm.ss");
    String s = formatter.format(new Date());
    System.out.println(s);//from www  .  ja  v  a2  s  . c  o m
  }
}



PreviousNext

Related