Learn to convert XMLGregorianCalendar to Date class or string value. Also learn to apply timezone changes and daylight saving effects as well.
In this example, we will learn to format XMLGregorianCalendar class to string in multiple patterns e.g. ‘MM/dd/yyyy hh:mm a z’. XMLGregorianCalendar to String in Date/TimeStamp Pattern In below code sample, I am creating instance of XMLGregorianCalendar with current Date object. Then I am formatting it to String format in given pattern. Output: 01/27/2017 01:32 PM […]
In java, java.util.Locale class represents a specific language and region of the world. If a class varies its behavior according to Locale, it is said to be locale-sensitive. Learn more.
Learn to use java java.util.Date class in various ways. These Date class usecase are frequently required, and having them in one place will help in saving time for many of us. Table of Contents Convert Date to String Parse String to Date Get current date Get Current Time Get Date from Calendar object Get Calendar […]
Java offers a lot of useful ways to get current date or get current time using Date, Calendar and newly introduces Java 8 Date/Time API classes. Let’s see some examples to understand them in detail. Table of Contents Get current date/time using Date class Get current date/time using Calendar class Get current date/time using LocalDateTime […]
Most of the applications today, which are targeted for a larger audience e.g. internet users, usually deal in money as well. In such application, a requirement will be to display money/currency in a format specific to that location or country. In this tutorial, I am giving some examples which will help you in location specific […]
If you are working in a java application and you are asked to make the application customized for international end users; then information present in simple tutorial will help you in achieving i18n (internationalization). I am parting the information into two: first for web application and second for a standalone java desktop application. To customize […]
All of us have come among situations when we have to parse user input for validation. Other fields such as text or numeric are rather easy, but date date validation is little bit difficult and a small error can leave the application in unstable state. Usually, SimpleDateFormat‘s parse() method is used for validation. If parse() […]