tribble.util
Class Time

java.lang.Object
  extended by tribble.util.Time

public abstract class Time
extends java.lang.Object

Primitive date and time formatting methods.

Since:
2000-05-23
Version:
$Revision: 1.2 $ $Date: 2003/02/09 03:46:14 $
Author:
David R. Tribble, david@tribble.com
Copyright ©2000-2001 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code provided that the original copyright and authorship notices remain intact.

Field Summary
static int FMT__DATE_MASK
           
static int FMT__HOUR_MASK
           
static int FMT__TIME_MASK
           
static int FMT_12HR
           
static int FMT_24HR
           
static int FMT_CCYY_DDD
           
static int FMT_CCYY_MM
           
static int FMT_CCYY_MM_DD
           
static int FMT_CCYYDDD
           
static int FMT_CCYYMMDD
           
static int FMT_HH_MM
           
static int FMT_HH_MM_SS
           
static int FMT_HH_MM_SS_MMM
           
static int FMT_HHMM
           
static int FMT_HHMMSS
           
static int FMT_HHMMSSMMM
           
static java.lang.String FMT_HR12
           
static java.lang.String FMT_HR24
           
static java.lang.String FMT_MDAY
           
static java.lang.String FMT_MIN
           
static int FMT_MM_DD
           
static int FMT_MMDD
           
static java.lang.String FMT_MON
           
static java.lang.String FMT_MON3
           
static java.lang.String FMT_MSEC
           
static java.lang.String FMT_SEC
           
static java.lang.String FMT_WDAY
           
static java.lang.String FMT_WEEK
           
static java.lang.String FMT_YDAY
           
static java.lang.String FMT_YEAR
           
static java.lang.String FMT_YR
           
static int FMT_YY_DDD
           
static int FMT_YY_MM_DD
           
static int FMT_YYDDD
           
static int FMT_YYMMDD
           
 
Method Summary
static java.lang.String getISO8601()
          Converts the current date into its corresponding ISO-8601 string, in the format "CCYY-MM-DD HH:MM:SS.mmm".
static void main(java.lang.String[] argv)
          Test driver.
static java.lang.String toISO8601(java.util.Date d)
          Converts date value d into its corresponding ISO-8601 string, in the format "CCYY-MM-DD HH:MM:SS.mmm".
static java.lang.String toISO8601(java.util.Date d, int fmt)
          Converts date value d into its corresponding ISO-8601 string, formatted according to the formatting option bitmask fmt.
static java.lang.String toISO8601(long d)
          Converts date value d into its corresponding ISO-8601 string, in the format "CCYY-MM-DD HH:MM:SS.mmm".
static java.lang.String toISO8601(long d, int fmt)
          Converts date value d into its corresponding ISO-8601 string, formatted according to the formatting option bitmask fmt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FMT__DATE_MASK

public static final int FMT__DATE_MASK
See Also:
Constant Field Values

FMT_CCYY_MM_DD

public static final int FMT_CCYY_MM_DD
See Also:
Constant Field Values

FMT_CCYY_DDD

public static final int FMT_CCYY_DDD
See Also:
Constant Field Values

FMT_CCYY_MM

public static final int FMT_CCYY_MM
See Also:
Constant Field Values

FMT_YY_MM_DD

public static final int FMT_YY_MM_DD
See Also:
Constant Field Values

FMT_YY_DDD

public static final int FMT_YY_DDD
See Also:
Constant Field Values

FMT_MM_DD

public static final int FMT_MM_DD
See Also:
Constant Field Values

FMT_CCYYMMDD

public static final int FMT_CCYYMMDD
See Also:
Constant Field Values

FMT_CCYYDDD

public static final int FMT_CCYYDDD
See Also:
Constant Field Values

FMT_YYMMDD

public static final int FMT_YYMMDD
See Also:
Constant Field Values

FMT_YYDDD

public static final int FMT_YYDDD
See Also:
Constant Field Values

FMT_MMDD

public static final int FMT_MMDD
See Also:
Constant Field Values

FMT__TIME_MASK

public static final int FMT__TIME_MASK
See Also:
Constant Field Values

FMT_HH_MM_SS_MMM

public static final int FMT_HH_MM_SS_MMM
See Also:
Constant Field Values

FMT_HH_MM_SS

public static final int FMT_HH_MM_SS
See Also:
Constant Field Values

FMT_HH_MM

public static final int FMT_HH_MM
See Also:
Constant Field Values

FMT_HHMMSSMMM

public static final int FMT_HHMMSSMMM
See Also:
Constant Field Values

FMT_HHMMSS

public static final int FMT_HHMMSS
See Also:
Constant Field Values

FMT_HHMM

public static final int FMT_HHMM
See Also:
Constant Field Values

FMT__HOUR_MASK

public static final int FMT__HOUR_MASK
See Also:
Constant Field Values

FMT_24HR

public static final int FMT_24HR
See Also:
Constant Field Values

FMT_12HR

public static final int FMT_12HR
See Also:
Constant Field Values

FMT_YR

public static final java.lang.String FMT_YR
See Also:
Constant Field Values

FMT_YEAR

public static final java.lang.String FMT_YEAR
See Also:
Constant Field Values

FMT_MON

public static final java.lang.String FMT_MON
See Also:
Constant Field Values

FMT_MON3

public static final java.lang.String FMT_MON3
See Also:
Constant Field Values

FMT_MDAY

public static final java.lang.String FMT_MDAY
See Also:
Constant Field Values

FMT_WDAY

public static final java.lang.String FMT_WDAY
See Also:
Constant Field Values

FMT_YDAY

public static final java.lang.String FMT_YDAY
See Also:
Constant Field Values

FMT_WEEK

public static final java.lang.String FMT_WEEK
See Also:
Constant Field Values

FMT_HR12

public static final java.lang.String FMT_HR12
See Also:
Constant Field Values

FMT_HR24

public static final java.lang.String FMT_HR24
See Also:
Constant Field Values

FMT_MIN

public static final java.lang.String FMT_MIN
See Also:
Constant Field Values

FMT_SEC

public static final java.lang.String FMT_SEC
See Also:
Constant Field Values

FMT_MSEC

public static final java.lang.String FMT_MSEC
See Also:
Constant Field Values
Method Detail

main

public static void main(java.lang.String[] argv)
Test driver.

Since:
1.1, 2000-05-23

toISO8601

public static java.lang.String toISO8601(java.util.Date d)
Converts date value d into its corresponding ISO-8601 string, in the format "CCYY-MM-DD HH:MM:SS.mmm".

Parameters:
d - The date value to convert.
Returns:
A string in ISO-8601 format.
Since:
1.1, 2000-05-23

toISO8601

public static java.lang.String toISO8601(long d)
Converts date value d into its corresponding ISO-8601 string, in the format "CCYY-MM-DD HH:MM:SS.mmm".

Parameters:
d - The date value to convert. This value is the number of milliseconds since the start of the Java epoch (1970-01-01 00:00:00.000 GMT).
Returns:
A string in ISO-8601 format.
Since:
1.1, 2000-05-23

toISO8601

public static java.lang.String toISO8601(java.util.Date d,
                                         int fmt)
Converts date value d into its corresponding ISO-8601 string, formatted according to the formatting option bitmask fmt.

Parameters:
d - The date value to convert.
fmt - The formatting option bitmasks (FMT_XXX), or-ed together.
Returns:
A string in ISO-8601 format.
Since:
1.1, 2000-05-23

toISO8601

public static java.lang.String toISO8601(long d,
                                         int fmt)
Converts date value d into its corresponding ISO-8601 string, formatted according to the formatting option bitmask fmt.

Parameters:
d - The date value to convert. This value is the number of milliseconds since the start of the Java epoch (1970-01-01 00:00:00.000 GMT).
fmt - The formatting option bitmasks (FMT_XXX), or-ed together.
Returns:
A string in ISO-8601 format.
Since:
1.1, 2000-05-23

getISO8601

public static java.lang.String getISO8601()
Converts the current date into its corresponding ISO-8601 string, in the format "CCYY-MM-DD HH:MM:SS.mmm".

Returns:
The current date and time as a string in ISO-8601 format.
Since:
1.1, 2000-05-23