Here you can find the source of formatHL7TSFormat4Date(Date time)
public static String formatHL7TSFormat4Date(Date time)
//package com.java2s; /*//from ww w .ja v a 2s . c o m * Copyright (C) 2009 Tolven Inc * 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. * * Contact: info@tolvenhealth.com * * @author anil * @version $Id: HL7DateFormatUtility.java,v 1.1 2009/04/06 00:50:26 jchurin Exp $ */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String HL7TSFormat4 = "yyyy"; public static String formatHL7TSFormat4Date(Date time) { return getSimpleDateFormat(HL7TSFormat4).format(time); } private static SimpleDateFormat getSimpleDateFormat(String format) { return new SimpleDateFormat(format); } }