-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
  • 39,949
  • 51
  • 178
  • 266

3 Answers3

3

Try dateFormat.format(curDate).

Cfx
  • 2,154
  • 2
  • 14
  • 21
2

Use:

dateFormat.format(curDate)
Jens
  • 63,364
  • 15
  • 92
  • 104
1
SimpleDateFormat format1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
System.out.println(format1.format(d1));
SonalPM
  • 1,319
  • 8
  • 17