1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.util;
16  
17  import java.text.DateFormat;
18  
19  import java.util.Locale;
20  import java.util.TimeZone;
21  
22  /**
23   * <a href="DateFormatFactoryUtil.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class DateFormatFactoryUtil {
28  
29      public static DateFormat getDate(Locale locale) {
30          return getDateFormatFactory().getDate(locale);
31      }
32  
33      public static DateFormat getDate(Locale locale, TimeZone timeZone) {
34          return getDateFormatFactory().getDate(locale, timeZone);
35      }
36  
37      public static DateFormat getDate(TimeZone timeZone) {
38          return getDateFormatFactory().getDate(timeZone);
39      }
40  
41      public static DateFormat getDateTime(Locale locale) {
42          return getDateFormatFactory().getDateTime(locale);
43      }
44  
45      public static DateFormat getDateTime(Locale locale, TimeZone timeZone) {
46          return getDateFormatFactory().getDateTime(locale, timeZone);
47      }
48  
49      public static DateFormat getDateTime(TimeZone timeZone) {
50          return getDateFormatFactory().getDateTime(timeZone);
51      }
52  
53      public static DateFormatFactory getDateFormatFactory() {
54          return _fastDateFormatFactory;
55      }
56  
57      public static DateFormat getSimpleDateFormat(String pattern) {
58          return getDateFormatFactory().getSimpleDateFormat(pattern);
59      }
60  
61      public static DateFormat getSimpleDateFormat(
62          String pattern, Locale locale) {
63  
64          return getDateFormatFactory().getSimpleDateFormat(pattern, locale);
65      }
66  
67      public static DateFormat getSimpleDateFormat(
68          String pattern, Locale locale, TimeZone timeZone) {
69  
70          return getDateFormatFactory().getSimpleDateFormat(
71              pattern, locale, timeZone);
72      }
73  
74      public static DateFormat getSimpleDateFormat(
75          String pattern, TimeZone timeZone) {
76  
77          return getDateFormatFactory().getSimpleDateFormat(
78              pattern, timeZone);
79      }
80  
81      public static DateFormat getTime(Locale locale) {
82          return getDateFormatFactory().getTime(locale);
83      }
84  
85      public static DateFormat getTime(Locale locale, TimeZone timeZone) {
86          return getDateFormatFactory().getTime(locale, timeZone);
87      }
88  
89      public static DateFormat getTime(TimeZone timeZone) {
90          return getDateFormatFactory().getTime(timeZone);
91      }
92  
93      public void setDateFormatFactory(
94          DateFormatFactory fastDateFormatFactory) {
95  
96          _fastDateFormatFactory = fastDateFormatFactory;
97      }
98  
99      private static DateFormatFactory _fastDateFormatFactory;
100 
101 }