Java Servlets Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP  Java Servlets Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java Servlets Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java Servlets Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java Servlets Application Hosting Web Hosting website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP,Python
Java Servlets Application Hosting Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP, Python Java Servlets Application Hosting Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, Python,JSP
Java Servlets Application Hosting Web Hosting Sign-Up Java Servlets Application Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting  Java Servlets Application Hosting Resellers web hosting, website hosting, web site hosting Java Servlets Application Hosting EZ Site Control Panel for web hosting,website hosting, web site hosting
Java Servlets Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python,JSP,  Fundraising
Java Servlets Application Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting
WWW.

Call Us Toll-Free
(877) 256-0328

Outside USA
1 - (201) 505-0430

Java Servlets Application Hosting Welcome Java Servlets Application Hosting Web Hosting Plans Overview , Fund Raising, Fundraising, web hosting, website hosting, web site hosting Java Servlets Application Hosting Fund Raising, Fundraising, web hosting Java Servlets Application Hosting Resellers, web Hosting Java Servlets Application Hosting Web Design, web Hosting Java Servlets Application Hosting Extra Services,  web Hosting Java Servlets Application Hosting Traffic Booster, web hosting Java Servlets Application Hosting Traffic Booster, web hosting Java Servlets Application Hosting Technical Support,  web Hosting Java Servlets Application Hosting webmaster tips,  web Hosting Java Servlets Application Hosting 30 Day Money Back, web hosting Java Servlets Application Hosting Legal Notices for Web Hosting Java Servlets Application Hosting Glossary Computer Terms for web Hosting Java Servlets Application Hosting Contact Information - web hosting

Site Map
Java Servlets Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python, JSP Java Servlets Application Hosting Java Servlets Application Hosting Java Servlets Application Hosting Java Servlets Application Hosting Java Servlets Application Hosting Changing Date Format Symbols (The Java™ Tutorials > Internationalization > Formatting)
Trail: Internationalization
Lesson: Formatting
Section: Dates and Times
Home Page > Internationalization > Formatting
Changing Date Format Symbols
The format method of the SimpleDateFormat class returns a String composed of digits and symbols. For example, in the String "Friday, April 10, 1998," the symbols are "Friday" and "April." If the symbols encapsulated in SimpleDateFormat don't meet your needs, you can change them with the DateFormatSymbols. You can change symbols that represent names for months, days of the week, and time zones, among others. The following table lists the DateFormatSymbols methods that allow you to modify the symbols:

DateFormatSymbol Methods

Setter Method Example of a Symbol the Method Modifies
setAmPmStrings PM
setEras AD
setMonths December
setShortMonths Dec
setShortWeekdays Tue
setWeekdays Tuesday
setZoneStrings PST

The following example invokes setShortWeekdays to change the short names of the days of the week from lowercase to uppercase characters. The full source code for this example is in DateFormatSymbolsDemo. The first element in the array argument of setShortWeekdays is a null String. Therefore the array is one-based rather than zero-based. The SimpleDateFormat constructor accepts the modified DateFormatSymbols object as an argument. Here is the source code:

Date today;
String result;
SimpleDateFormat formatter;
DateFormatSymbols symbols;
String[] defaultDays;
String[] modifiedDays;

symbols = new DateFormatSymbols(new Locale("en","US"));
defaultDays = symbols.getShortWeekdays();

for (int i = 0; i < defaultDays.length; i++) {
    System.out.print(defaultDays[i] + " ");
}
System.out.println();

String[] capitalDays = {
			"", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
symbols.setShortWeekdays(capitalDays);

modifiedDays = symbols.getShortWeekdays();
for (int i = 0; i < modifiedDays.length; i++) {
    System.out.print(modifiedDays[i] + " ");
}
System.out.println();
System.out.println();

formatter = new SimpleDateFormat("E", symbols);
today = new Date();
result = formatter.format(today);
System.out.println(result);

The preceding code generates this output:

   Sun	 Mon	 Tue	 Wed	 Thu	 Fri	 Sat
   SUN	 MON	 TUE	 WED	 THU	 FRI	 SAT
WED
Previous page: Customizing Formats
Next page: Messages
 
 
 

Add to My Yahoo!

XML icon

Add to Google

 

 

 

 

 

 

 

 

 

 

 

JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP at JSP.aldenWEBhosting.com Servlets at servlets.aldenWEBhosting.com Tomcat at Tomcat.aldenWEBhosting.com mysql at mysql.aldenWEBhosting.com Java at Java.aldenWEBhosting.com Web Hosts Portal Web Links Web Links Web Hosting JSP Solutions Web Links JSP Solutions Web Hosting Servlets Solutions Web Links Servlets Solutions Web Hosting Web Links Web Links . . .
.
.
. .
.
. .
. . . . . . . . . . . jsp hosting servlets hosting web hosting web sites designed cheap web hosting web site hosting myspace web hosting