0

I am currently working on my project for my professional course. I am implementing a digital diary. I would be having a diary page (a multiline textbox maybe) And a TextView on top to show the current DATE (without time). How do I show a NON-editabale textbox with today's date shown in it.

ameenhere
  • 1,938
  • 18
  • 33

3 Answers3

0

In order to get the current date and time use the below Links and iin order make it non editable in XML file make editable = false also focusable = false.

LINK1

LINK2

Community
  • 1
  • 1
Shankar Agarwal
  • 40,326
  • 8
  • 70
  • 67
0

its simple

        Date dt = new Date();
        int date = dt.getDate();
        int month = dt.getMonth()+1;
        int year = dt.getYear();
        year += 1900;
        int day = dt.getDay();
        String[] days = { "Sunday", "Monday", "Tuesday","WednesDay", "Thursday", "Friday", "Saterday" };
        String curDate = date + "/" + month + "/" + year + " " + days[day];
Chirag Patel
  • 11,068
  • 3
  • 24
  • 38
0

Use this code :

String mydate = java.text.DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime());

It 'll print : Feb 5, 2013, 12:35:46PM

The Holy Coder
  • 6,374
  • 8
  • 36
  • 71