Write code to get Current Date in yyyy-MM-dd hh:mm:ss format
//package com.book2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] argv) { System.out.println(getCurrentFormatDate()); }//from www . ja v a2 s.c om public static String getCurrentFormatDate() { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String datetime = sdf.format(date); return datetime; } }