Here you can find the source of getToday()
public static String getToday()
//package com.java2s; import java.util.*; public class Main { public static String getToday() { Calendar now = Calendar.getInstance(); return fd(new java.util.Date(now.getTime().getTime())); }//from w w w.j a va 2 s. c o m public static String fd(java.util.Date d) { java.util.Calendar calendar = java.util.Calendar.getInstance(); calendar.setTime(d); return (lz(calendar.get(Calendar.DATE), 2) + "/" + lz(calendar.get(Calendar.MONTH) + 1, 2) + "/" + calendar.get(Calendar.YEAR)); } public static String lz(int src, int len) { return (lz(src + "", len)); } public static String lz(String src, int len) { for (int i = 0; src.length() < len; i++) { src = "0" + src; } return (src); } }