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 ww  w  .j  a  v a 2s  .com*/
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.





















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat