Tuesday 14 November 2017

How to get today's Date in java in the following pattern dd/MM/yyyy?

I am trying the
code



 Date today = new
Date();
Date todayWithZeroTime;
{
try {

todayWithZeroTime = formatter.parse(formatter.format(today));
} catch
(ParseException e) {
e.printStackTrace();

}

}
String date =
todayWithZeroTime.toString();


it
is giving output :- Wed Dec 11 00:00:00 IST 2019
where I want
11/12/2019
where 11/12/2019 is today's date

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...