0

how to display current date and time in java

complete codes if there is someone who got them please....

2nd Nov 2020, 10:22 AM
Daniel
Daniel - avatar
2 Respuestas
+ 3
Here's are some of the ways to get current time or date , forgive me if I missed to include other ways. import java.util.*; import java.time.LocalDate; public class Program { public static void main(String[] args) { //calender instance Date date1 = Calendar.getInstance().getTime(); //util date Date date2 = new Date(); //sql date java.sql.Date sqlDate= new java.sql.Date(date2.getTime()); //from java 8 LocalDate local = LocalDate.now(); System.out.println(date1); System.out.println(date2); System.out.println(sqlDate); System.out.println(local); } }
2nd Nov 2020, 10:48 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
0
Thanks I really appreciate
2nd Nov 2020, 12:03 PM
Daniel
Daniel - avatar