Java examples for java.util:Date Format
Convert Date To String in MM-dd-yyyy format
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] argv) { Date date = new Date(); System.out.println(DateToString(date)); }/*from www . ja va 2s . c om*/ public static String DateToString(Date date) { SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy"); return df.format(date); } }