Category: 10. Java Internationalization
-
Unicode Conversion from/to Reader/Writer
Reader and Writer classes are character oriented stream classes. These can be used to read and convert Unicode characters. Conversion Following example will showcase conversion of a Unicode String to UTF8 byte[] and UTF8 byte[] to Unicode byte[] using Reader and Writer classes. Example Open Compiler Output It will print the following result.
-
Unicode Conversion from/to String
In java, text is internally stored in Unicode format. If input/output is in differnt format then conversion is required. Conversion Following example will showcase conversion of a Unicode String to UTF8 byte[] and UTF8 byte[] to Unicode byte[]. Example Open Compiler Output It will print the following result.
-
UTC
UTC stands for Co-ordinated Universal Time. It is time standard and is commonly used across the world. All timezones are computed comparatively with UTC as offset. For example, time in Copenhagen, Denmark is UTC + 1 means UTC time plus one hour. It is independent of Day light savings and should be used to store…
-
Date Format Patterns
Followings is the use of characters in date formatting patterns. Sr.No. Class & Description 1 GTo display Era. 2 yTo display Year. Valid values yy, yyyy. 3 MTo display Month. Valid values MM, MMM or MMMMM. 4 dTo display day of month. Valid values d, dd. 5 hTo display hour of day (1-12 AM/PM). Valid…
-
DateFormatSymbols Class
Using DecimalFormatSymbols class, the default separator symbols, grouping separator symbols etc. can be changed. Following example is illustrating the same. Example Open Compiler Output It will print the following result.
-
Locale specific Formatting Date
Locale can be used to create locale specific formatting over a pattern in SimpleDateFormat class. See the following example of using locale specific SimpleDateFormat class. Example Open Compiler Output It will print the following result.
-
SimpleDateFormat Class
java.text.SimpleDateFormat class formats dates as per the given pattern. It is also used to parse dates from string where string contains date in mentioned format. See the following example of using SimpleDateFormat class. Example Open Compiler Output It will print the following result.
-
Formatting Date and Time
DateFormat class provides various formats to format the date and time together. DateFormat.getDateTimeInstance() method is to be used. See the example below. Example In following example we’ll show how to use different formats to format date and time. Open Compiler Output It will print the following result.
-
Formatting Time
DateFormat class provides various formats to format the time. DateFormat.getTimeInstance() method is to be used. See the example below. Example In following example we’ll show how to use different formats to format time. Open Compiler Output It will print the following result.
-
Formatting Date
DateFormat class provides various formats to format the date. Following is list of some of the formats. Example In following example we’ll show how to use different formats. Open Compiler Output It will print the following result.