Package org.jpos.iso

Class ISODate


  • public class ISODate
    extends java.lang.Object
    provides various parsing and format functions used by the ISO 8583 specs.
    See Also:
    ISOUtil
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long ONE_YEAR  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String formatDate​(java.util.Date d, java.lang.String pattern)
      Formats a date object, using the default time zone for this host WARNING: See important issue related to date pattern.
      static java.lang.String formatDate​(java.util.Date d, java.lang.String pattern, java.util.TimeZone timeZone)
      You should use this version of formatDate() if you want a specific timeZone to calculate the date on.
      static java.lang.String getANSIDate​(java.util.Date d)  
      static java.lang.String getANSIDate​(java.util.Date d, java.util.TimeZone timeZone)  
      static java.lang.String getDate​(java.util.Date d)  
      static java.lang.String getDate​(java.util.Date d, java.util.TimeZone timeZone)  
      static java.lang.String getDateTime​(java.util.Date d)  
      static java.lang.String getDateTime​(java.util.Date d, java.util.TimeZone timeZone)  
      static java.lang.String getEuropeanDate​(java.util.Date d)  
      static java.lang.String getEuropeanDate​(java.util.Date d, java.util.TimeZone timeZone)  
      static java.lang.String getExpirationDate​(java.util.Date d)  
      static java.lang.String getExpirationDate​(java.util.Date d, java.util.TimeZone timeZone)  
      static java.lang.String getJulianDate​(java.util.Date d)  
      static java.lang.String getJulianDate​(java.util.Date d, java.util.TimeZone timeZone)  
      static java.lang.String getTime​(java.util.Date d)  
      static java.lang.String getTime​(java.util.Date d, java.util.TimeZone timeZone)  
      static java.util.Date parse​(java.lang.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 java.util.Date parse​(java.lang.String s, java.util.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 java.util.Date parseDateTime​(java.lang.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 java.util.Date parseDateTime​(java.lang.String s, java.util.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 java.util.Date parseISODate​(java.lang.String d)
      try to find out suitable date given [YY[YY]]MMDDhhmmss format
      (difficult thing being finding out appropiate year)
      static java.util.Date parseISODate​(java.lang.String d, long currentTime)
      try to find out suitable date given [YY[YY]]MMDDhhmmss format
      (difficult thing being finding out appropiate year)
      static java.util.Date parseISODate​(java.lang.String d, long currentTime, java.util.TimeZone timeZone)
      try to find out suitable date given [YY[YY]]MMDDhhmmss format
      (difficult thing being finding out appropiate year)
      static java.util.Date parseISODate​(java.lang.String d, java.util.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
    • Method Detail

      • formatDate

        public static java.lang.String formatDate​(java.util.Date d,
                                                  java.lang.String pattern)
        Formats a date object, using the default time zone for this host WARNING: See important issue related to date pattern.
        Parameters:
        d - date object to be formatted
        pattern - to be used for formatting
      • formatDate

        public static java.lang.String formatDate​(java.util.Date d,
                                                  java.lang.String pattern,
                                                  java.util.TimeZone timeZone)
        You should use this version of formatDate() if you want a specific timeZone to calculate the date on. WARNING: See important issue related to date pattern.
        Parameters:
        d - date object to be formatted
        pattern - to be used for formatting
        timeZone - for GMT for example, use TimeZone.getTimeZone("GMT") and for Uruguay use TimeZone.getTimeZone("GMT-03:00")
      • parse

        public static java.util.Date parse​(java.lang.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 java.util.Date parse​(java.lang.String s,
                                           java.util.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 java.util.Date parseDateTime​(java.lang.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 java.util.Date parseDateTime​(java.lang.String s,
                                                   java.util.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 java.util.Date parseISODate​(java.lang.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 java.util.Date parseISODate​(java.lang.String d,
                                                  java.util.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 java.util.Date parseISODate​(java.lang.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 java.util.Date parseISODate​(java.lang.String d,
                                                  long currentTime,
                                                  java.util.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 java.lang.String getDateTime​(java.util.Date d)
        Returns:
        date in MMddHHmmss format suitable for FIeld 7
      • getDateTime

        public static java.lang.String getDateTime​(java.util.Date d,
                                                   java.util.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 java.lang.String getTime​(java.util.Date d)
        Returns:
        date in HHmmss format - suitable for field 12
      • getTime

        public static java.lang.String getTime​(java.util.Date d,
                                               java.util.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 java.lang.String getDate​(java.util.Date d)
        Returns:
        date in MMdd format - suitable for field 13
      • getDate

        public static java.lang.String getDate​(java.util.Date d,
                                               java.util.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 java.lang.String getANSIDate​(java.util.Date d)
        Returns:
        date in yyMMdd format - suitable for ANSI field 8
      • getANSIDate

        public static java.lang.String getANSIDate​(java.util.Date d,
                                                   java.util.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 java.lang.String getEuropeanDate​(java.util.Date d)
      • getEuropeanDate

        public static java.lang.String getEuropeanDate​(java.util.Date d,
                                                       java.util.TimeZone timeZone)
      • getExpirationDate

        public static java.lang.String getExpirationDate​(java.util.Date d)
        Returns:
        date in yyMM format - suitable for field 14
      • getExpirationDate

        public static java.lang.String getExpirationDate​(java.util.Date d,
                                                         java.util.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 java.lang.String getJulianDate​(java.util.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 java.lang.String getJulianDate​(java.util.Date d,
                                                     java.util.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