Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to get Current month name,date and year in android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 12.7k
    Comment on it

    This example shows how to get / Display the current month, date and year from calendar. To acomplish this I have used Calender.getInstance() method of Calender class. let's see the code example:


       protected void onCreate(Bundle savedInstanceState) {
            Calendar c = Calendar.getInstance();
            String[]monthName={"January","February","March", "April", "May", "June", "July",
                    "August", "September", "October", "November",
            String month=monthName[c.get(Calendar.MONTH)];
            System.out.println("Month name:"+month);
            int year=c.get(Calendar.YEAR);
            int date=c.get(Calendar.DATE);
            textView.setText(" "+ date+ " "+month+ " /" + "" + year);


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: