01: /* ====================================================================
02: * The QueryForm License, Version 1.1
03: *
04: * Copyright (c) 1998 - 2005 David F. Glasser. All rights
05: * reserved.
06: *
07: * Redistribution and use in source and binary forms, with or without
08: * modification, are permitted provided that the following conditions
09: * are met:
10: *
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: *
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in
16: * the documentation and/or other materials provided with the
17: * distribution.
18: *
19: * 3. The end-user documentation included with the redistribution,
20: * if any, must include the following acknowledgment:
21: * "This product includes software developed by
22: * David F. Glasser."
23: * Alternately, this acknowledgment may appear in the software itself,
24: * if and wherever such third-party acknowledgments normally appear.
25: *
26: * 4. The names "QueryForm" and "David F. Glasser" must
27: * not be used to endorse or promote products derived from this
28: * software without prior written permission. For written
29: * permission, please contact dglasser@pobox.com.
30: *
31: * 5. Products derived from this software may not be called "QueryForm",
32: * nor may "QueryForm" appear in their name, without prior written
33: * permission of David F. Glasser.
34: *
35: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38: * DISCLAIMED. IN NO EVENT SHALL DAVID F. GLASSER, THE APACHE SOFTWARE
39: * FOUNDATION OR ITS CONTRIBUTORS, OR ANY AUTHORS OR DISTRIBUTORS
40: * OF THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47: * SUCH DAMAGE.
48: * ====================================================================
49: *
50: * This product includes software developed by the
51: * Apache Software Foundation (http://www.apache.org/).
52: *
53: * ====================================================================
54: *
55: * $Source: /cvsroot/qform/qform/src/org/glasser/sql/DateFormatter.java,v $
56: * $Revision: 1.2 $
57: * $Author: dglasser $
58: * $Date: 2005/04/30 16:25:11 $
59: *
60: * --------------------------------------------------------------------
61: */
62:
63: package org.glasser.sql;
64:
65: public class DateFormatter implements org.glasser.util.Formatter {
66:
67: private java.text.SimpleDateFormat format = null;
68:
69: public DateFormatter(String formatString) {
70: format = new java.text.SimpleDateFormat(formatString);
71: }
72:
73: public String getFormattedString(Object obj) {
74: if (obj == null)
75: return "NULL";
76: else
77: return format.format(obj);
78: }
79: }
|