Simple DateFormat Class

SimpleDateFonnat is a concrete subclass of DateFormat. It allows you to define your own formatting patterns that are used to display date and time information.

One of its Constructors is shown here:

SimpleDateFormat(String Format String)

The argumentativeness describes how date and time information is displayed. An , example of its ‘use is given here:

SiinpleDateFormat  sdf = siinpleoateFormat( -dd ‘MMM yyyy hh:ss zz.z·)

The symbols used in the formatting string determine the information that is , displayed. These symbols and gives a description of each.

In most cases, the number of times a symbol is repeated determines how that data is presented. Text information is displayed in an abbreviated form if the pattern letter is repeated less than four times. Otherwise, the abbreviated form is used. For example, a zzzz pattern can display Pacific Daylight Time, and  zzz pattern can display PDT.

for numbers, the number of times a pattern letter is repeated determines how many digits arc presented. For example, hh:mm:ss can present 01:51:15,but h.m:s displays the same time value as 1:51:15.

Finally, M or MM causes the month to be displayed as one or two digits. However; three or more repetitions of M cause the month to be displayed as a text string. The following program shows how this class is used.

[vfb id=1]

Share This