Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

What it's about.

When the mouse is clicked on the applet a java.util.Date instance is created that contains the date and the time on your station.

Then java.text.DateFormat is asked to create a date/time instance of DateFormat with default settings .

We let it format our date

,and show the result in the TextArea.

We then ask DateFormat to give us an instance with different settings .

Instead of getDateTimeInstance we can use getDateInstance .

Custom formatting is done by using java.text.SimpleDateFormat .

Notice the capital M !!!, lower case m means minutes . Also notice the single quotes.

The beauty of using these is that the user gets to see date and time as she/he is accustomed to, according to the station's national settings.

.