gran.tools.formatter
Class DateFormatter

java.lang.Object
  extended bygran.tools.formatter.DateFormatter
All Implemented Interfaces:
java.io.Serializable

public class DateFormatter
extends java.lang.Object
implements java.io.Serializable

This class provides operations for convertion Timestamp into String and vice-versa, using Locale and Timezone

See Also:
Serialized Form

Constructor Summary
DateFormatter(java.lang.String tz, java.lang.String lc)
          Constructs new DateFormatter for specified Timezone Id and Locale String representation
DateFormatter(java.util.TimeZone tz, java.util.Locale lc)
          Constructs new DateFormatter for specified Timezone and Locale
 
Method Summary
static java.util.Locale[] getAvailableLocales()
           
 java.util.Calendar getCalendar()
          returns Calendar for the Locale and the Timezone
 java.text.DateFormat getDateFormat()
          returns DateFormat object for this DateFormatter
 java.util.Locale getLocale()
          returns Locale
 java.lang.String getPattern()
          returns a pattern, associated with the Locale and the Timezone
 java.util.TimeZone getTimeZone()
          returns Timezone
static void main(java.lang.String[] args)
          Just test
 java.sql.Timestamp parse(java.lang.String param)
           
 java.lang.String parse(java.sql.Timestamp param)
          converts Timestamp into String
static java.util.Locale toLocale(java.lang.String lc)
          Language is always lower case, and country is always upper case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateFormatter

public DateFormatter(java.util.TimeZone tz,
                     java.util.Locale lc)
Constructs new DateFormatter for specified Timezone and Locale


DateFormatter

public DateFormatter(java.lang.String tz,
                     java.lang.String lc)
Constructs new DateFormatter for specified Timezone Id and Locale String representation

Method Detail

getLocale

public java.util.Locale getLocale()
returns Locale


getTimeZone

public java.util.TimeZone getTimeZone()
returns Timezone


getCalendar

public java.util.Calendar getCalendar()
returns Calendar for the Locale and the Timezone


getDateFormat

public java.text.DateFormat getDateFormat()
returns DateFormat object for this DateFormatter


parse

public java.sql.Timestamp parse(java.lang.String param)
                         throws java.lang.Exception
Throws:
java.lang.Exception

parse

public java.lang.String parse(java.sql.Timestamp param)
converts Timestamp into String


toLocale

public static java.util.Locale toLocale(java.lang.String lc)
Language is always lower case, and country is always upper case. If the language is missing, the string will begin with an underbar. If both the language and country fields are missing, this function will return the empty string, even if the variant field is filled in (you can't have a locale with just a variant-- the variant must accompany a valid language or country code). Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr_MAC"

Parameters:
lc -

getPattern

public java.lang.String getPattern()
returns a pattern, associated with the Locale and the Timezone


main

public static void main(java.lang.String[] args)
Just test


getAvailableLocales

public static java.util.Locale[] getAvailableLocales()


Copyright © 2002-2004 TrackStudio, Ltd. All Rights Reserved.