Here you can find the source of currentDate(String format, Locale locale)
public static String currentDate(String format, Locale locale)
//package com.java2s; /* ========================================== * CategorizeUserForum : a free Java graph-theory library * ========================================== * // w w w. j av a 2 s . co m * salmuz : Carranza Alarcon Yonatan Carlos * * (C) Copyright 2014, by salmuz and Contributors. * * Project Info: https://github.com/salmuz/Graphes_Multi_Plateformes * Project Creator: salmuz (https://www.assembla.com/spaces/salmuz-java) * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, * Inc., * * ------------------ * Point.java * ------------------ * (C) Copyright 2014, by salmuz and Contributors * * Original Author: Carranza Alarcon Yonatan Carlos * Contributor(s): * * Changes * ------- * */ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String currentDate(String format, Locale locale) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, locale); simpleDateFormat.setLenient(false); return simpleDateFormat.format(new Date()); } }