Sunday, 5 February 2017

android - How to convert the Date object into "dd/MM/yyyy HH:mm:ss" format in Java




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


Answer



Use:



dateFormat.format(curDate)

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...