org.jpos.iso
Class ISODate

java.lang.Object
  extended by org.jpos.iso.ISODate

public class ISODate
extends Object

provides various parsing and format functions used by the ISO 8583 specs.

Version:
$Id$
Author:
apr@cs.com.uy, Hani S. Kirollos
See Also:
ISOUtil

Field Summary
static long ONE_YEAR
           
 
Constructor Summary
ISODate()
           
 
Method Summary
static String formatDate(Date d, String pattern)
          Formats a date object, using the default time zone for this host
static String formatDate(Date d, String pattern, TimeZone timeZone)
          You should use this version of formatDate() if you want a specific timeZone to calculate the date on.
static String getANSIDate(Date d)
           
static String getANSIDate(Date d, TimeZone timeZone)
           
static String getDate(Date d)
           
static String getDate(Date d, TimeZone timeZone)
           
static String getDateTime(Date d)
           
static String getDateTime(Date d, TimeZone timeZone)
           
static String getEuropeanDate(Date d)
           
static String getEuropeanDate(Date d, TimeZone timeZone)
           
static String getExpirationDate(Date d)
           
static String getExpirationDate(Date d, TimeZone timeZone)
           
static String getJulianDate(Date d)
           
static String getJulianDate(Date d, TimeZone timeZone)
           
static String getTime(Date d)
           
static String getTime(Date d, TimeZone timeZone)
           
static Date parse(String s)
          converts a string in DD/MM/YY format to a Date object Warning: return null on invalid dates (prints Exception to console) Uses default time zone for this host
static Date parse(String s, TimeZone timeZone)
          converts a string in DD/MM/YY format to a Date object Warning: return null on invalid dates (prints Exception to console)
static Date parseDateTime(String s)
          converts a string in DD/MM/YY HH:MM:SS format to a Date object Warning: return null on invalid dates (prints Exception to console) Uses default time zone for this host
static Date parseDateTime(String s, TimeZone timeZone)
          converts a string in DD/MM/YY HH:MM:SS format to a Date object Warning: return null on invalid dates (prints Exception to console)
static Date parseISODate(String d)
          try to find out suitable date given [YY[YY]]MMDDhhmmss format
(difficult thing being finding out appropiate year)
static Date parseISODate(String d, long currentTime)
          try to find out suitable date given [YY[YY]]MMDDhhmmss format
(difficult thing being finding out appropiate year)
static Date parseISODate(String d, long currentTime, TimeZone timeZone)
          try to find out suitable date given [YY[YY]]MMDDhhmmss format
(difficult thing being finding out appropiate year)
static Date parseISODate(String d, TimeZone timeZone)
          try to find out suitable date given [YY[YY]]MMDDhhmmss format
(difficult thing being finding out appropiate year)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONE_YEAR

public static final long ONE_YEAR
See Also:
Constant Field Values
Constructor Detail

ISODate

public ISODate()
Method Detail

formatDate

public static String formatDate(Date d,
                                String pattern)
Formats a date object, using the default time zone for this host

Parameters:
d - date object to be formatted
pattern - to be used for formatting

formatDate

public static String formatDate(Date d,
                                String pattern,
                                TimeZone timeZone)
You should use this version of formatDate() if you want a specific timeZone to calculate the date on.

Parameters:
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")

parse

public static Date parse(String s)
converts a string in DD/MM/YY format to a Date object Warning: return null on invalid dates (prints Exception to console) Uses default time zone for this host

Returns:
parsed Date (or null)

parse

public static Date parse(String s,
                         TimeZone timeZone)
converts a string in DD/MM/YY format to a Date object Warning: return null on invalid dates (prints Exception to console)

Parameters:
s - String in DD/MM/YY recorded in timeZone
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
parsed Date (or null)

parseDateTime

public static Date parseDateTime(String s)
converts a string in DD/MM/YY HH:MM:SS format to a Date object Warning: return null on invalid dates (prints Exception to console) Uses default time zone for this host

Returns:
parsed Date (or null)

parseDateTime

public static Date parseDateTime(String s,
                                 TimeZone timeZone)
converts a string in DD/MM/YY HH:MM:SS format to a Date object Warning: return null on invalid dates (prints Exception to console)

Parameters:
s - string in DD/MM/YY HH:MM:SS format recorded in timeZone
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
parsed Date (or null)

parseISODate

public static Date parseISODate(String d)
try to find out suitable date given [YY[YY]]MMDDhhmmss format
(difficult thing being finding out appropiate year)

Parameters:
d - date formated as [YY[YY]]MMDDhhmmss, typical field 13 + field 12
Returns:
Date

parseISODate

public static Date parseISODate(String d,
                                TimeZone timeZone)
try to find out suitable date given [YY[YY]]MMDDhhmmss format
(difficult thing being finding out appropiate year)

Parameters:
d - date formated as [YY[YY]]MMDDhhmmss, typical field 13 + field 12
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
Date

parseISODate

public static Date parseISODate(String d,
                                long currentTime)
try to find out suitable date given [YY[YY]]MMDDhhmmss format
(difficult thing being finding out appropiate year)

Parameters:
d - date formated as [YY[YY]]MMDDhhmmss, typical field 13 + field 12
currentTime - currentTime in millis
Returns:
Date

parseISODate

public static Date parseISODate(String d,
                                long currentTime,
                                TimeZone timeZone)
try to find out suitable date given [YY[YY]]MMDDhhmmss format
(difficult thing being finding out appropiate year)

Parameters:
d - date formated as [YY[YY]]MMDDhhmmss, typical field 13 + field 12
currentTime - currentTime in millis
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
Date

getDateTime

public static String getDateTime(Date d)
Returns:
date in MMddHHmmss format suitable for FIeld 7

getDateTime

public static String getDateTime(Date d,
                                 TimeZone timeZone)
Parameters:
d - date object to be formatted
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
date in MMddHHmmss format suitable for FIeld 7

getTime

public static String getTime(Date d)
Returns:
date in HHmmss format - suitable for field 12

getTime

public static String getTime(Date d,
                             TimeZone timeZone)
Parameters:
d - date object to be formatted
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
date in HHmmss format - suitable for field 12

getDate

public static String getDate(Date d)
Returns:
date in MMdd format - suitable for field 13

getDate

public static String getDate(Date d,
                             TimeZone timeZone)
Parameters:
d - date object to be formatted
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
date in MMdd format - suitable for field 13

getANSIDate

public static String getANSIDate(Date d)
Returns:
date in yyMMdd format - suitable for ANSI field 8

getANSIDate

public static String getANSIDate(Date d,
                                 TimeZone timeZone)
Parameters:
d - date object to be formatted
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
date in yyMMdd format - suitable for ANSI field 8

getEuropeanDate

public static String getEuropeanDate(Date d)

getEuropeanDate

public static String getEuropeanDate(Date d,
                                     TimeZone timeZone)

getExpirationDate

public static String getExpirationDate(Date d)
Returns:
date in yyMM format - suitable for field 14

getExpirationDate

public static String getExpirationDate(Date d,
                                       TimeZone timeZone)
Parameters:
d - date object to be formatted
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
date in yyMM format - suitable for field 14

getJulianDate

public static String getJulianDate(Date d)
Parameters:
d - date object to be formatted
Returns:
date in YDDD format suitable for bit 31 or 37 depending on interchange

getJulianDate

public static String getJulianDate(Date d,
                                   TimeZone timeZone)
Parameters:
d - date object to be formatted
timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
Returns:
date in YDDD format suitable for bit 31 or 37 depending on interchange


Copyright © 1998-2012 jPOS.org. All Rights Reserved.