コード例 #1
0
ファイル: ISO8601.java プロジェクト: blasty3/SOSJ-UoA-ECE
  /**
   * The main is here only for debugging. You can test your conversion by executing the following
   * command:
   *
   * <p><code> java jade.lang.acl.ISO8601 <yourtoken> </code>
   */
  public static void main(String argv[]) {

    System.out.println(localCal);

    System.out.println("USAGE: java ISO8601 DateTimetoken");
    System.out.println(argv[0]);
    try {
      System.out.println("Testing default behaviour (using UTC DateTime):");
      System.out.println("  ISO8601.toDate(" + argv[0] + ") returns:" + ISO8601.toDate(argv[0]));
      System.out.println(
          "  converting that back to a string gives:" + ISO8601.toString(ISO8601.toDate(argv[0])));
      Date d1 = new Date();
      System.out.println("  ISO8601.toString( new Date() ) returns:" + ISO8601.toString(d1));
      System.out.println(
          "  converting that back to a date gives:" + ISO8601.toDate(ISO8601.toString(d1)));

      System.out.println("Testing local time (for backwards compatability):");
      // ISO8601.useUTCtime = false;
      System.out.println("  ISO8601.toDate(" + argv[0] + ") returns:" + ISO8601.toDate(argv[0]));
      System.out.println(
          "  converting that back to a string gives:"
              + ISO8601.toString(ISO8601.toDate(argv[0]), false));
      System.out.println(
          "  ISO8601.toString( new Date(), false ) returns:" + ISO8601.toString(d1, false));
      System.out.println(
          "  converting that back to a date gives:" + ISO8601.toDate(ISO8601.toString(d1, false)));
    } catch (Exception e) {
      e.printStackTrace();
    }

    try {
      System.out.println(
          "ISO8601.toRelativeTimeString("
              + argv[0]
              + ") returns:"
              + ISO8601.toRelativeTimeString(Long.parseLong(argv[0])));

      Date d = new Date(Integer.parseInt(argv[0]));
      System.out.println(
          "ISO8601.toString(" + d + ", false) returns:" + ISO8601.toString(d, false));
    } catch (Exception e1) {
    }
  }
コード例 #2
0
ファイル: ACLMessage.java プロジェクト: LeviPorto/Jamder
 /**
  * Reads <code>:reply-by</code> slot.
  *
  * @return The value of <code>:reply-by</code>slot, as a string.
  * @see jade.lang.acl.ACLMessage#getReplyByDate().
  * @deprecated Since the value of this slot is a Date by definition, then the <code>getReplyByDate
  *     </code> should be used that returns a Date
  */
 public String getReplyBy() {
   if (reply_byInMillisec != 0) return ISO8601.toString(new Date(reply_byInMillisec));
   else return null;
 }