0

How to get current java date? I need to use it in my app for setting posting time. I tried use DateSelecter libdary but that didnt work in the way I needed I to, it printed it in a non human readable way.

Charles
  • 50,943
  • 13
  • 104
  • 142

1 Answers1

1

You're missing the java tsg. But this is how to get thr date:

DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
 System.out.println(dateFormat.format(date));
Aashir
  • 2,621
  • 4
  • 21
  • 37