calendar Date String as yyyy-MM-dd format - Android java.util

Android examples for java.util:Calendar Format

Description

calendar Date String as yyyy-MM-dd format

Demo Code


//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static String calendar2DateString(Calendar calendar) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        return format.format(calendar.getTime());
    }/*  w w  w  .  j av  a2 s .  co m*/
}

Related Tutorials