Package org.jpos.iso
Class ISODate
- java.lang.Object
-
- org.jpos.iso.ISODate
-
-
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 hoststatic 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 hoststatic 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)
-
-
-
Field Detail
-
ONE_YEAR
public static final long ONE_YEAR
- See Also:
- Constant Field Values
-
-
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 formattedpattern
- 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 formattedpattern
- to be used for formattingtimeZone
- 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 timeZonetimeZone
- 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 timeZonetimeZone
- 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 12timeZone
- 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 12currentTime
- 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 12currentTime
- currentTime in millistimeZone
- 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 formattedtimeZone
- 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 formattedtimeZone
- 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 formattedtimeZone
- 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 formattedtimeZone
- 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 formattedtimeZone
- 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 formattedtimeZone
- 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
-
-