|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jade.lang.acl.ISO8601
This class contains a set of static methods that convert
to/from the Date Time format adopted by FIPA.
The FIPA format is based on ISO8601, with the addition of milliseconds.
Using the java.text.SimpleDateFormat
notation, it is:
yyyyMMdd'T'HHmmssSSS'Z'
, where the 'T'
serves to separate the Day from the Time,
and the 'Z'
indicates that the time is in UTC.
The FIPA specs permit either local or UTC time, however, they do
express a preference for UTC time (this is particularly helpful when
passing messages between agents running on machines in different timezones).
toString(false)
is called).
Constructor Summary | |
ISO8601()
Default constructor. |
Method Summary | |
static void |
main(java.lang.String[] argv)
The main is here only for debugging. |
static java.util.Date |
toDate(java.lang.String dateTimeToken)
This method converts a FIPA DateTime token to a java.util.Date .
|
static java.lang.String |
toRelativeTimeString(long millisec)
this method converts into a string in ISO8601 format representing relative time from the current time |
static java.lang.String |
toString(java.util.Date d)
This method converts a java.util.Date into a FIPA DateTime
token by using the UTC time. |
static java.lang.String |
toString(java.util.Date d,
boolean useUTCtime)
This method converts a java.util.Date into a FIPA DateTime token.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ISO8601()
Method Detail |
public static java.util.Date toDate(java.lang.String dateTimeToken) throws java.lang.Exception
java.util.Date
.
It will accept both local and UTC time formats.
an
- Exception if the String is not a valid dateTime
java.lang.Exception
public static java.lang.String toString(java.util.Date d, boolean useUTCtime)
java.util.Date
into a FIPA DateTime token.
Note: the current default behaviour is to generate dates in UTC time.
see ISO8601.useUTCtime
for details.
useUTCtime
- controls the style used by toString
,
'true' generates tokens using UTC time, 'false' using local time.
If you need to send messages to agents compiled with older versions
of Jade, then set this to false
.
public static java.lang.String toString(java.util.Date d)
java.util.Date
into a FIPA DateTime
token by using the UTC time.
public static java.lang.String toRelativeTimeString(long millisec)
millisec
- is the number of milliseconds from now
public static void main(java.lang.String[] argv)
java jade.lang.acl.ISO8601
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |