DateUtil
Keywords: uk.ac.ic.doc.automed.util.DateUtil class

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

## uk.ac.ic.doc.automed.util
Class DateUtil

    java.lang.Object
      uk.ac.ic.doc.automed.util.DateUtil

    public class DateUtil

extends java.lang.Object

Method Summary
`static java.lang.String` | `getBriefDateString()` Return a brief date string of current date Example: 20/7/2006 1:1:1---> 20060720
`static java.lang.String` | `getClockRepresentation(java.util.Date dateObj)` Return a standard clock representation of a Date object
`static java.lang.String` | `getClockRepresentation(long numMilliSecs)` Return a standard clock representation from the number of millisecs
`static java.lang.String` | `getClockRepresentation(long[] timeElements)` Return a standard clock representation of a time value.
`static java.lang.String` | `getDate()` Return the current date/time in a standard format
`static java.util.Date` | `getDate(long millisecs)` Return a date from number of its milli-seconds
`static long` | `getDateAsMillisecs()` Return the current date as the number of milli-seconds
`static java.lang.String` | `getDateString()` Return a date string of current date Example: 20/7/2006 1:1:1---> 20060720_010101
`static long` | `getMilliseconds(java.util.Date dateObj)` Convert a `Date` object into the number of milliseconds from start of the clock
`static void` | `main(java.lang.String[] args)`
`static long[]` | `subtractDate(java.util.Date date1, java.util.Date date2)` Subtract `Date`1 from `Date`2 to return the result as an array of numbers of hours, minutes, and seconds

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

Method Detail

### subtractDate

    public static long[] subtractDate(java.util.Date date1,
                                      java.util.Date date2)

  Subtract `Date`1 from `Date`2 to return the result as an array of numbers of hours, minutes, and seconds

  Parameters:
    `date1` - `Date` object to be subtracted
    `date2` - `Date` object to be subtracted from (i.e. date2 - date1)
  Returns:
    `long`[] a long-type array of hours, minutes and seconds

### getDate

    public static java.lang.String getDate()

  Return the current date/time in a standard format

  Parameters:
    `String` - date/time string

### getDateAsMillisecs

    public static long getDateAsMillisecs()

  Return the current date as the number of milli-seconds

### getDate

    public static java.util.Date getDate(long millisecs)

  Return a date from number of its milli-seconds

### getDateString

    public static java.lang.String getDateString()

  Return a date string of current date
  Example: 20/7/2006 1:1:1---> 20060720_010101

### getBriefDateString

    public static java.lang.String getBriefDateString()

  Return a brief date string of current date
  Example: 20/7/2006 1:1:1---> 20060720

### getMilliseconds

    public static long getMilliseconds(java.util.Date dateObj)

  Convert a `Date` object into the number of milliseconds from start of the clock

### getClockRepresentation

    public static java.lang.String getClockRepresentation(long numMilliSecs)

  Return a standard clock representation from the number of millisecs

### getClockRepresentation

    public static java.lang.String getClockRepresentation(java.util.Date dateObj)

  Return a standard clock representation of a Date object

### getClockRepresentation

    public static java.lang.String getClockRepresentation(long[] timeElements)

  Return a standard clock representation of a time value. For example, this
  method represents a time value of 2 hours, 30 minutes and 33 seconds as
  02:30:33. It is a useful representation for age-time.

  Parameters:
    `{@link` - long}[] an array of time elements, typically the number of hours,
    minutes and seconds
  Returns:
    String the clock representation of time value

### main

    public static void main(java.lang.String[] args)

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