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
  • 2,203
  • 21
  • 36

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
  • 34,573
  • 7
  • 66
  • 64
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,416
  • 3
  • 26
  • 38
0

Use this code :

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

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

Manish Dubey
  • 4,206
  • 8
  • 36
  • 65