#1 Assignment help service provider

4.7/5 rating | 10,000+ happy students | Great tutors 24/7

Prices starting $9.5/page


GET HELP INSTANTLY

Tag - java

Java Program – Basic Date Formatting

Basic Date Formatting Let us see an example for Basic Date Formatting. package com.ack.j2se.date; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class BasicDateFormatting { public static void main( String[] args ) throws Exception { // get today's date Date today = Calendar.getInstance().getTime(); // create a short version date formatter DateFormat shortFormatter = SimpleDateFormat.getDateInstance( SimpleDateFormat.SHORT ); // create a long version date formatter DateFormat longFormatter = SimpleDateFormat.getDateInstance( SimpleDateFormat.LONG ); // create date time formatter, medium for day, long for time DateFormat mediumFormatter = SimpleDateFormat.getDateTimeInstance( SimpleDateFormat.MEDIUM, SimpleDateFormat.LONG ); // use the formatters to output the dates System.out.println( shortFormatter.format( today ) [...]