Format date in long in yyyy-MM-dd format - Android java.util

Android examples for java.util:Date Format

Description

Format date in long in yyyy-MM-dd format

Demo Code

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

public class Main{

    public static String getDay(long time) {

        return new SimpleDateFormat("yyyy-MM-dd").format(time);

    }//from ww w.j a v  a 2  s  . c o  m

}

Related Tutorials