Here you can find the source of formatG(Date date)
public static String formatG(Date date)
//package com.java2s; //License from project: LGPL import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String FORMAT_STYLE_G = "yyyy-MM-dd"; public static String formatG(Date date) { SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_STYLE_G); if (null != date && !"".equals(date)) { return sdf.format(date); }// w w w .j a va 2 s . c o m return null; } }