Java Format - Java DateFormat.getNumberFormat()








Syntax

DateFormat.getNumberFormat() has the following syntax.

public NumberFormat getNumberFormat()

Example

In the following code shows how to use DateFormat.getNumberFormat() method.

import java.text.DateFormat;
import java.util.Date;
//from www  .ja  va 2 s. c  om
public class Main {
  public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.LONG);
    
    
    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.getNumberFormat().getMinimumFractionDigits());

  }
}

The code above generates the following result.