Jul 27

You can use the getDisplayName() in the Calendar class to get a localized (according to Locale) string for any of the Calendar fields.

For example to get the day name you can use the following:

Calendar cal = Calendar.getInstance();
String day = cal.getDisplayName(Calendar.DAY_OF_WEEK, 
   Calendar.LONG, Locale.getDefault())

If you’re looking for an algorithm to get the day of the week then try Zeller’s congruence.

written by objects \\ tags: , ,


Leave a Reply

You must be logged in to post a comment.