Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Locale; public class Main { public static String formatData(String format, Object object) { try { return new SimpleDateFormat(format, Locale.getDefault()).format(object); } catch (Exception e) { return ""; } } }