Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get current date in dd-mm-yyyy format

how to get current date in DD-MM-YYYY format in BlackBerry

i have already tried the following, but it gives me output of 1318502493

long currentTime = System.currentTimeMillis() / 1000;

System.out.println("Current time in :" + currentTime);
like image 495
Hitarth Avatar asked Oct 13 '11 11:10

Hitarth


People also ask

How do I change the date format from dd mm yyyy to dd mm yyyy?

Your answer First, pick the cells that contain dates, then right-click and select Format Cells. Select Custom in the Number Tab, then type 'dd-mmm-yyyy' in the Type text box, then click okay. It will format the dates you specify.

Does new date () Return current date?

In JavaScript, we can easily get the current date or time by using the new Date() object. By default, it uses our browser's time zone and displays the date as a full text string, such as "Fri Jun 17 2022 10:54:59 GMT+0100 (British Summer Time)" that contains the current date, time, and time zone.


2 Answers

private String pattern = "dd-MM-yyyy";
String dateInString =new SimpleDateFormat(pattern).format(new Date());
like image 91
Balconsky Avatar answered Oct 06 '22 01:10

Balconsky


DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
return formatter.format(new Date());
like image 35
Nathan Q Avatar answered Oct 05 '22 23:10

Nathan Q