Java Format - Java SimpleDateFormat .applyLocalizedPattern (String pattern)








Syntax

SimpleDateFormat.applyLocalizedPattern(String pattern) has the following syntax.

public void applyLocalizedPattern(String pattern)

Example

In the following code shows how to use SimpleDateFormat.applyLocalizedPattern(String pattern) method.

import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
//w w w .  j  av a 2  s.  co m
public class Main {
  public static void main(String[] argv) throws Exception {

    SimpleDateFormat formatter = new SimpleDateFormat();
    formatter.applyLocalizedPattern("MMM");
    String s = formatter.format(new Date());
    System.out.println(s);
  }
}

The code above generates the following result.