Java Format - Java SimpleDateFormat .formatToCharacterIterator (Object obj)








Syntax

SimpleDateFormat.formatToCharacterIterator(Object obj) has the following syntax.

public AttributedCharacterIterator formatToCharacterIterator(Object obj)

Example

In the following code shows how to use SimpleDateFormat.formatToCharacterIterator(Object obj) method.

//w w w.  jav  a 2 s  . c o m
import java.text.CharacterIterator;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
  public static void main(String[] argv) throws Exception {

    Format formatter = new SimpleDateFormat("MMM");
    CharacterIterator s = formatter.formatToCharacterIterator(new Date());
    System.out.println(s.last());
  }
}

The code above generates the following result.