60 622
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #56511 in Java | JSP | JSF for Christine

Question #56511
To make a script to display only current month,day,year, or date
Expert's answer
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.Locale;

public class DatePrinter {

public static void main(String[] args) {

GregorianCalendar calendar = new GregorianCalendar();

SimpleDateFormat format = new SimpleDateFormat("MMMM",Locale.ENGLISH);
String mounth = format.format(calendar.getTime());
System.out.println(mounth);

format = new SimpleDateFormat("EEEE",Locale.ENGLISH);
String day = format.format(calendar.getTime());
System.out.println(day);

format = new SimpleDateFormat("yyyy");
String year = format.format(calendar.getTime());
System.out.println(year);

format = new SimpleDateFormat("dd/MM/yyyy");
String date = format.format(calendar.getTime());
System.out.println(date);


}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions