-4

I have the code below

DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date curDate = new Date();

What is happening ::

For the curDate i get as: Tue Nov 11 11:36:05 IST 2014


What i want::

I want to convert into format: dd/MM/yyyy HH:mm:ss


Question: How can I achieve this

Devrath
  • 42,072
  • 54
  • 195
  • 297

3 Answers3

3

Try dateFormat.format(curDate).

Cfx
  • 2,272
  • 2
  • 15
  • 21
2

Use:

dateFormat.format(curDate)
Jens
  • 67,715
  • 15
  • 98
  • 113
1
SimpleDateFormat format1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
System.out.println(format1.format(d1));
SonalPM
  • 1,317
  • 8
  • 17