Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.mx.util
Class TimeFormat

    java.lang.Object
      org.jboss.mx.util.TimeFormat

All Implemented Interfaces:
  Serializable

public final class TimeFormat
extends Object
implements Serializable

TimeFormat is a utility class for converting a long into a human readable string.

Example usage: `System.out.println("You have been online for: "+TimeFormat.valueOf(milliseconds));` FIXME: expanded features need documentation. JGH

Version:
  $Revision: 1.4 $
Author:
  Jeff Haynie
See Also:
  Serialized Form

Field Summary
`static boolean` | `DEBUG`
`static long` | `ONE_DAY`
`static long` | `ONE_HOUR`
`static long` | `ONE_MILLISECOND`
`static long` | `ONE_MINUTE`
`static long` | `ONE_SECOND`
`static int` | `ROUND_TO_DAY`
`static int` | `ROUND_TO_HOUR`
`static int` | `ROUND_TO_MILLISECOND`
`static int` | `ROUND_TO_MINUTE`
`static int` | `ROUND_TO_SECOND`

Method Summary
`void` | `add(TimeFormat t)` add a timeformat
`String` | `format(int round)` format string based on rouding
`static String` | `format(String format, long time)` format with a date time
`long` | `getDays()` get days
`void` | `getDays(TimeFormat t)` get days from a time format
`long` | `getHours()` get hours
`void` | `getHours(TimeFormat t)` get hours from a time format
`long` | `getMilliseconds()` get the milliseconds
`long` | `getMinutes()` get minutes
`void` | `getMinutes(TimeFormat t)` get minutes from a time format
`int` | `getRouding()` return the rounding
`long` | `getSeconds()` get seconds
`void` | `getSeconds(TimeFormat t)` get seconds from a time format
`void` | `getTime(TimeFormat t)` update time
`static void` | `main(String[] args)` test
`void` | `setRounding(int r)` set rounding - one of ROUND_TO_MILLISECONDS, etc.
`String` | `toString()` print out the time format in a string representation
`static String` | `valueOf(long t)` return a string formatted version of time `t` rounding to `round`
`static String` | `valueOf(long t, int round)` return a string formatted version of time `t` rounding to `round`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEBUG

    public static final boolean DEBUG

See Also:
  Constant Field Values

### ONE_MILLISECOND

    public static final long ONE_MILLISECOND

See Also:
  Constant Field Values

### ONE_SECOND

    public static final long ONE_SECOND

See Also:
  Constant Field Values

### ONE_MINUTE

    public static final long ONE_MINUTE

See Also:
  Constant Field Values

### ONE_HOUR

    public static final long ONE_HOUR

See Also:
  Constant Field Values

### ONE_DAY

    public static final long ONE_DAY

See Also:
  Constant Field Values

### ROUND_TO_MILLISECOND

    public static final int ROUND_TO_MILLISECOND

See Also:
  Constant Field Values

### ROUND_TO_SECOND

    public static final int ROUND_TO_SECOND

See Also:
  Constant Field Values

### ROUND_TO_MINUTE

    public static final int ROUND_TO_MINUTE

See Also:
  Constant Field Values

### ROUND_TO_HOUR

    public static final int ROUND_TO_HOUR

See Also:
  Constant Field Values

### ROUND_TO_DAY

    public static final int ROUND_TO_DAY

See Also:
  Constant Field Values

Method Detail

### getDays

    public long getDays()

  get days

  Returns:
    days

### getMinutes

    public long getMinutes()

  get minutes

  Returns:
    minutes

### getHours

    public long getHours()

  get hours

  Returns:
    hours

### getSeconds

    public long getSeconds()

  get seconds

  Returns:
    seconds

### add

    public void add(TimeFormat t)

  add a timeformat

  Parameters:
    `t` -

### getDays

    public void getDays(TimeFormat t)

  get days from a time format

  Parameters:
    `t` -

### getHours

    public void getHours(TimeFormat t)

  get hours from a time format

  Parameters:
    `t` -

### getMinutes

    public void getMinutes(TimeFormat t)

  get minutes from a time format

  Parameters:
    `t` -

### getSeconds

    public void getSeconds(TimeFormat t)

  get seconds from a time format

  Parameters:
    `t` -

### getTime

    public void getTime(TimeFormat t)

  update time

  Parameters:
    `t` -

### getMilliseconds

    public long getMilliseconds()

  get the milliseconds

### toString

    public String toString()

  print out the time format in a string representation

### setRounding

    public void setRounding(int r)

  set rounding - one of ROUND_TO_MILLISECONDS, etc.

### getRouding

    public int getRouding()

  return the rounding

### format

    public String format(int round)

  format string based on rouding

### valueOf

    public static String valueOf(long t,
                                 int round)

  return a string formatted version of time `t` rounding to `round`

  Parameters:
    `t` -
    `round` -
  Returns:
    String value

### valueOf

    public static String valueOf(long t)

  return a string formatted version of time `t` rounding to `round`

  Parameters:
    `t` -
  Returns:
    String value

### format

    public static String format(String format,
                                long time)

  format with a date time

### main

    public static void main(String[] args)

  test

  Parameters:
    `args` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.