×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: userc865b
Added: Aug 31, 2017 9:21 AM
Views: 3
Tags: java
  1. DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
  2. //get current date time with Date()
  3. Date date = new Date();
  4. System.out.println(dateFormat.format(date));
  5.  
  6. //get current date time with Calendar()
  7. Calendar cal = Calendar.getInstance();
  8. System.out.println(dateFormat.format(cal.getTime()));