SimpleDateFormat applyLocalizedPattern() Method in Java with Examples Last Updated : 19 Jul, 2021 Comments Improve Suggest changes Like Article Like Report The applyLocalizedPattern() Method of SimpleDateFormat class is used to apply a localized string pattern to this date format. This pattern can be set by the user. Syntax: public void applyLocalizedPattern(String pattern) Parameters: The method takes one parameter pattern of String type and refers to the new date and time that is to be applied.Return Value: The method returns void type. Below programs illustrate the working of applyLocalizedPattern() Method of SimpleDateFormat: Example 1: Java // Java code to illustrate // applyLocalizedPattern() method import java.text.*; import java.util.Calendar; public class SimpleDateFormat_Demo { public static void main(String[] args) throws InterruptedException { SimpleDateFormat SDFormat = new SimpleDateFormat(); // Initializing calendar Object Calendar cal = Calendar.getInstance(); // Using the following pattern String new_pat = "MM / dd / yy HH:mm Z"; // Use of applyLocalizedPattern() SDFormat.applyLocalizedPattern(new_pat); System.out.println("Applying the format: " + SDFormat .toLocalizedPattern()); } } Output: Applying the format: MM / dd / yy HH:mm Z Example 2: Java // Java code to illustrate // applyLocalizedPattern() method import java.text.*; import java.util.*; public class SimpleDateFormat_Demo { public static void main(String args[]) throws Exception { // Initializing SDF SimpleDateFormat SDFormat = new SimpleDateFormat(); // Applying LocalizedPattern SDFormat.applyLocalizedPattern("dd"); String str = SDFormat.format(new Date()); // Printing todays date System.out.println("Today is: " + str); // Applying LocalizedPattern SDFormat.applyLocalizedPattern("MMM"); String str1 = SDFormat.format(new Date()); // Printing the month System.out.println("Month is: " + str1); } } Output: Today is: 30 Month is: Jan Comment More infoAdvertise with us Next Article SimpleDateFormat applyLocalizedPattern() Method in Java with Examples C chinmoy lenka Follow Improve Article Tags : Misc Java Java-Functions Java-text package Java-SimpleDateFormat +1 More Practice Tags : JavaMisc Similar Reads SimpleDateFormat applyPattern() Method in Java with Examples The applyPattern() Method of SimpleDateFormat class is used to set a given defined pattern to the Date Format. It simply converts a particular date and time to a specific format as defined by the user for eg., dd/ MM/ yyyy HH:mm Z or MM/ dd/ yyyy HH:mm Z.Syntax: public void applyPattern(String patte 2 min read MessageFormat applyPattern() method in Java with Example The applyPattern() method of java.text.MessageFormat class is used to set the new pattern text for current MessageFormat by overriding the current FormatElement, FormatType and FormatStyle. Syntax: public void applyPattern(String newPattern) Parameter: This method takes string newPattern as paramete 2 min read ChronoLocalDateTime toLocalDate() method in Java with Examples The toLocalDate() method of a ChronoLocalDateTime interface is used to convert this ChronoLocalDateTime to an LocalDate. The method returns the LocalDate part of this ChronoLocalDateTime. Syntax: default LocalDate toLocalDate() Parameters: This method do not accept any parameter. Return value: This 1 min read SimpleDateFormat toLocalizedPattern() Method in Java with Examples The toLocalizedPattern() Method of SimpleDateFormat class is used to return a localized pattern formatted string describing this date format. In other words a particular date is converted to a local pattern such as M/d/yy h:mm a. Syntax: public String toLocalizedPattern() Parameters: The method does 2 min read DateFormat setCalendar() Method in Java with Examples The setCalendar() Method of DateFormat class in Java is used to set the calendar associated with this date/time format object. In the initial stage the default settings of calendar is used along with the default locale. Syntax: public void setCalendar(Calendar new_calendar) Parameter: The method tak 2 min read Like