Month getDisplayName(TextStyle style, Locale locale)
gets the textual representation, such as 'Jan' or 'December'.
getDisplayName
has the following syntax.
public String getDisplayName(TextStyle style, Locale locale)
The following example shows how to use getDisplayName
.
import java.time.LocalDate; import java.time.Month; import java.time.format.TextStyle; import java.util.Locale; //from w ww . j a v a2s . c o m public class Main { public static void main(String[] args) { Month m = Month.from(LocalDate.now()); System.out.println(m.getDisplayName(TextStyle.SHORT,Locale.UK)); } }
The code above generates the following result.