Java Calendar to String getDateString(Calendar cal)

Here you can find the source of getDateString(Calendar cal)

Description

get Date String

License

Apache License

Declaration

public static String getDateString(Calendar cal) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

public class Main {
    public static String getDateString(Calendar cal) {
        int year = cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONDAY) + 1;
        int day = cal.get(Calendar.DAY_OF_MONTH);
        return year + "-" + month + "-" + day;
    }/*from   w ww .j av  a 2s.c  om*/
}

Related

  1. CalendarToString(Calendar fecha, String formato)
  2. calendarToXSDString(Calendar cal, String fmt)
  3. dateToCalendar(final String date)
  4. dateToString(Calendar date, DateFormat format)
  5. getDateString(Calendar cal)
  6. getDateString(Calendar calendar)
  7. getDateToString(Calendar argCal)
  8. getString(Calendar calendar)
  9. toString(Calendar c)