Good day! Made such a task. Create an application that displays the name of the developer, the date and time of receipt of the task, as well as the date and time of delivery of the task. To get the latest date and time, use the Calendar class from the java.util package.
Posted by:
import java.util.Calendar; import java.util.Date; public class Test{ public static void main (String args []){ String s = "Василевса"; Date d = new Date(); System.out.println("Получения задания для " + s + " " + d); Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR,2011); c.set(Calendar.MONTH,Calendar.JUNE); c.set(Calendar.DAY_OF_MONTH,30); System.out.println("Сдача задания для " + s + " " + c.getTime()); } }
Displays the result:
Getting the job for Vasileus Mon May 23 19:26:42 BDT 2011
Delivery of the assignment for Vasilev Thu Jun 30 19:26:42 BDT 2011
- How can you alter or add, to deduce another time, where it is written Delivery of the task displays the time 19:26:42, but you need to change it for another time.
- I also wanted the result to output in Russian without the time of minutes and seconds.
Like this:
Getting a job for Vasilevs Monday May 23 2011 or Monday May 23, 2011 or Monday 23.05.2011
Delivery of the assignment for Vasilevs Wednesday June 30 2011 or Wednesday 30 June 2011 or Wednesday 30.06.2011