You are on page 1of 1

// GET DATE & TIME IN ANY FORMAT

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

public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";

public static String now() {


Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());

You might also like