Here you can find the source of getCurrentDate(String formatStr)
public static String getCurrentDate(String formatStr)
//package com.java2s; /******************************************************************************* * Copyright Duke Comprehensive Cancer Center and SemanticBits * /*w w w. j a v a 2 s . c o m*/ * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/c3pr/LICENSE.txt for details. ******************************************************************************/ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String DISPLAY_DATE_FORMAT = "MM/dd/yyyy"; public static String getCurrentDate(String formatStr) { // This is temporary fix, lot of places in the code the dateformat is coded as mm/dd/yyyy // instead of MM/dd/yyyy. if ("mm/dd/yyyy".equals(formatStr)) { formatStr = DISPLAY_DATE_FORMAT; } SimpleDateFormat formatter = new SimpleDateFormat(formatStr); Date currentDate = new Date(); return formatter.format(currentDate); } }