public class DateTimeConverter
extends java.lang.Object
AS400Date
,
AS400Time
,
AS400Timestamp
Constructor and Description |
---|
DateTimeConverter(AS400 system)
Constructs a DateTimeConverter object.
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
convert(byte[] data,
java.lang.String inFormat)
Returns a converted Date object.
|
byte[] |
convert(byte[] data,
java.lang.String inFormat,
java.lang.String outFormat)
Converts date and time values from the input format to the requested output format.
|
byte[] |
convert(java.util.Date date,
java.lang.String outFormat)
Returns the converted date and time in a byte array.
|
static java.util.TimeZone |
timeZoneForSystem(AS400 system)
Returns a TimeZone object to represent the time zone for the specified system.
|
public DateTimeConverter(AS400 system)
system
- The system.public byte[] convert(byte[] data, java.lang.String inFormat, java.lang.String outFormat) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
This method effectively just re-arranges the time format and returns it. The input and output values are relative to the same time zone. Therefore, no adjustments are made based on time-zone.
data
- The date and time value to be converted.inFormat
- The input date and time format.
Possible values are:
outFormat
- The output date and time format.
Possible values are:
AS400SecurityException
- If a security or authority error
occurs.ErrorCompletingRequestException
- If an error occurs before
the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with
the system.ObjectDoesNotExistException
- If the object does not exist on the system.public java.util.Date convert(byte[] data, java.lang.String inFormat) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
data
- The date and time value to be converted.
The value is assumed to be relative to the IBM i system's time zone.inFormat
- The format of the date and time value being provided.
Possible values are:
AS400SecurityException
- If a security or authority error
occurs.ErrorCompletingRequestException
- If an error occurs before
the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with
the system.ObjectDoesNotExistException
- If the object does not exist on the system.public byte[] convert(java.util.Date date, java.lang.String outFormat) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
date
- The Date object to be converted.outFormat
- The format of the returned date and time value.
Possible values are:
AS400SecurityException
- If a security or authority error
occurs.ErrorCompletingRequestException
- If an error occurs before
the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with
the system.ObjectDoesNotExistException
- If the object does not exist on the system.public static java.util.TimeZone timeZoneForSystem(AS400 system) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
system
- The IBM i system.AS400SecurityException
- If a security or authority error
occurs.ErrorCompletingRequestException
- If an error occurs before
the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with
the system.ObjectDoesNotExistException
- If the API used to retrieve the information does not exist on the system.AS400.getTimeZone()