Here you can find the source of date2StringPattern(Date value, String pattern)
public static String date2StringPattern(Date value, String pattern)
//package com.java2s; /*//from ww w. j a v a 2 s.c o m * Copyright (C) 2010 Viettel Telecom. All rights reserved. * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String date2StringPattern(Date value, String pattern) { if (value != null) { SimpleDateFormat dateTimeNoSlash = new SimpleDateFormat(pattern); return dateTimeNoSlash.format(value); } return ""; } }