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
    • 408
    Comment on it

    In the below example code I have described, how to get Current month name , date and year from Calendar to do this I have used getInstance() method.


       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: