Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static String getCurrentDateString() { Calendar date = Calendar.getInstance(); int day = date.get(Calendar.DATE); int month = (date.get(Calendar.MONTH)) + 1; int year = date.get(Calendar.YEAR); String dateString = month + "-" + day + "-" + year; return dateString; } }