All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.openthinks.libs.sql.lang.DateFormatUtils Maven / Gradle / Ivy

The newest version!
package com.openthinks.libs.sql.lang;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Date formatter helper.
 * @author dailey
 *
 */
public class DateFormatUtils {

	static final Map formatMap = new HashMap();

	public static String format(Date date, String formatPattern) {
		DateFormat formater = formatMap.get(formatPattern);
		if (formater == null) {
			formater = new SimpleDateFormat(formatPattern);
			formatMap.put(formatPattern, formater);
		}
		return formater.format(date);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy