calendar Long String as yyyy-MM-dd HH:mm:00 format - Android java.util

Android examples for java.util:Calendar Format

Description

calendar Long String as yyyy-MM-dd HH:mm:00 format

Demo Code


//package com.java2s;

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

public class Main {
    public static String calendar2LongString(Calendar calendar) {
        SimpleDateFormat format = new SimpleDateFormat(
                "yyyy-MM-dd HH:mm:00");
        return format.format(calendar.getTime());
    }// w ww  .ja va  2  s .c om
}

Related Tutorials