org.jutil
Class TTime

java.lang.Object
  extended by org.jutil.TTime

public final class TTime
extends java.lang.Object

This is the TTime utility code class.


Field Summary
static long DAY
          Const time value HOUR_24 = 86,400,000ms = 24 hr
USAGE: long timeToWait = org.jutil.TTime.HOUR_24;
static long HOUR_1
          Const time value HOUR_1 = 3,600,000ms = 1 hr
USAGE: long timeToWait = org.jutil.TTime.HOUR_1;
static long HOUR_12
          Const time value HOUR_12 = 43,200,000ms = 12 hr
USAGE: long timeToWait = org.jutil.TTime.HOUR_12;
static long HOUR_24
          Const time value HOUR_24 = 86,400,000ms = 24 hr
USAGE: long timeToWait = org.jutil.TTime.HOUR_24;
static long MIN_1
          Const time value MIN_1 = 60,000ms = 1 min
USAGE: long timeToWait = org.jutil.TTime.MIN_1;
static long MIN_10
          Const time value MIN_10 = 600,000ms = 10 min
USAGE: long timeToWait = org.jutil.TTime.MIN_10;
static long MIN_30
          Const time value MIN_30 = 1,800,000ms = 30 min
USAGE: long timeToWait = org.jutil.TTime.MIN_30;
static long MIN_5
          Const time value MIN_5 = 300,000ms = 5 min
USAGE: long timeToWait = org.jutil.TTime.MIN_5;
static long SEC_1
          Const time value SEC_1 = 1,000ms = 1 sec
USAGE: long timeToWait = org.jutil.TTime.SEC_1;
static long SEC_10
          Const time value SEC_10 = 10,000ms = 10 sec
USAGE: long timeToWait = org.jutil.TTime.SEC_10;
static long SEC_30
          Const time value SEC_30 = 30,000ms = 30 sec
USAGE: long timeToWait = org.jutil.TTime.SEC_30;
static long SEC_5
          Const time value SEC_5 = 5,000ms = 5 sec
USAGE: long timeToWait = org.jutil.TTime.SEC_5;
static long WEEK
          Const time value WEEK = 604,800,000ms = 1 week
USAGE: long timeToWait = org.jutil.TTime.WEEK;
 
Constructor Summary
TTime()
          Ensure that no one can create instances of this Class.
 
Method Summary
static java.sql.Time create(int year, int month, int day, int hrs, int min)
           
static java.sql.Time create(int year, int month, int day, int hrs, int min, int sec)
           
static java.sql.Time create(java.lang.String s)
          create from a string in JDBC Timestamp escape format to a Time value usage: TTime.create("1999-02-02 08:30:00.0");
static java.lang.String formatTimeElaspsedToString(long time)
           
static long getAccurateTime(java.sql.Timestamp timestamp)
          USAGE: org.jutil.TTime.getAccurateTime( Timestamp timestamp );
static long getTime()
          USAGE: org.jutil.TTime.getTime();
static long getUniqueTime()
          USAGE: org.jutil.TTime.getUniqueTime();
static boolean isTimestampInRange(java.sql.Timestamp test, java.sql.Timestamp start, java.sql.Timestamp end)
          USAGE: org.jutil.TTime.isTimestampInRange( Timestamp test, Timestamp start, Timestamp end );
static void main(java.lang.String[] args)
           
static java.util.Calendar parseISO8061DateTimeString(java.lang.String value)
          parse format expected "yyyy-MM-dd'T'HH:mm:ss" "yyyy-MM-ddTHH:mm:ss" => 2007-04-03T20:56:13 "yyyy-MM-ddTHH:mm:ss:zz" => 2007-04-03T20:56:13:GMT+10:00
static void tick(long ms)
          USAGE: org.jutil.TTime.tick(long ms)
static long timeElaspsed(long time)
          USAGE: org.jutil.TTime.timeElaspsed(long time); long timeStarted = getTime(); { // do some operation code here ...
static java.lang.String timeElaspsedToString(long time)
          USAGE: org.jutil.TTime.timeElaspsed(long time); long timeStarted = getTime(); { // do some operation code here ...
static java.lang.String toGMTString(long time)
          USAGE: org.jutil.TTime.toGMTString(long time); formats long time to cookie GMT String
Wed, 01 Jan 2020 12:00:00 GMT
static java.lang.String toISO8061DateTimeString(java.util.Calendar cal, boolean incTimeZone)
           
static java.lang.String toISO8061DateTimeString(java.util.Date date, boolean incTimeZone)
           
static java.lang.String toISO8061DateTimeString(long time)
          USAGE: org.jutil.TTime.toISO8061DateTimeString(long time); formats long time to to ISO8061 DateTime String
"yyyy-MM-ddTHH:mm:ss" => 2007-04-03T20:56:13
static java.lang.String toISO8061DateTimeString(long time, boolean incTimeZone)
          damm this should be ISO8601 USAGE: org.jutil.TTime.toISO8061DateTimeString(long time, boolean incTimeZone); formats long time to to ISO8061 DateTime String with timezone
#NOTE Time zone portion has NOT been tested "yyyy-MM-ddTHH:mm:ss" => 2007-04-03T20:56:13 "yyyy-MM-ddTHH:mm:ss:zz" => 2007-04-03T20:56:13:GMT+10:00
static java.lang.String toSecString(long time)
          USAGE: org.jutil.TTime.toSecString(long time);
static java.lang.String toSimpleDateFormat(long time, java.lang.String format)
          USAGE: org.jutil.TTime.toSimpleDateFormat(long time, final String format); org.jutil.TTime.toSimpleDateFormat(time, "dd MM yyyy");
static java.lang.String toSimpleString(long time)
          USAGE: org.jutil.TTime.toSimpleString(long time);
static java.lang.String toString(long time)
          USAGE: org.jutil.TTime.toString(long time);
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEC_1

public static final long SEC_1
Const time value SEC_1 = 1,000ms = 1 sec
USAGE: long timeToWait = org.jutil.TTime.SEC_1;

See Also:
Constant Field Values

SEC_5

public static final long SEC_5
Const time value SEC_5 = 5,000ms = 5 sec
USAGE: long timeToWait = org.jutil.TTime.SEC_5;

See Also:
Constant Field Values

SEC_10

public static final long SEC_10
Const time value SEC_10 = 10,000ms = 10 sec
USAGE: long timeToWait = org.jutil.TTime.SEC_10;

See Also:
Constant Field Values

SEC_30

public static final long SEC_30
Const time value SEC_30 = 30,000ms = 30 sec
USAGE: long timeToWait = org.jutil.TTime.SEC_30;

See Also:
Constant Field Values

MIN_1

public static final long MIN_1
Const time value MIN_1 = 60,000ms = 1 min
USAGE: long timeToWait = org.jutil.TTime.MIN_1;

See Also:
Constant Field Values

MIN_5

public static final long MIN_5
Const time value MIN_5 = 300,000ms = 5 min
USAGE: long timeToWait = org.jutil.TTime.MIN_5;

See Also:
Constant Field Values

MIN_10

public static final long MIN_10
Const time value MIN_10 = 600,000ms = 10 min
USAGE: long timeToWait = org.jutil.TTime.MIN_10;

See Also:
Constant Field Values

MIN_30

public static final long MIN_30
Const time value MIN_30 = 1,800,000ms = 30 min
USAGE: long timeToWait = org.jutil.TTime.MIN_30;

See Also:
Constant Field Values

HOUR_1

public static final long HOUR_1
Const time value HOUR_1 = 3,600,000ms = 1 hr
USAGE: long timeToWait = org.jutil.TTime.HOUR_1;

See Also:
Constant Field Values

HOUR_12

public static final long HOUR_12
Const time value HOUR_12 = 43,200,000ms = 12 hr
USAGE: long timeToWait = org.jutil.TTime.HOUR_12;

See Also:
Constant Field Values

HOUR_24

public static final long HOUR_24
Const time value HOUR_24 = 86,400,000ms = 24 hr
USAGE: long timeToWait = org.jutil.TTime.HOUR_24;

See Also:
Constant Field Values

DAY

public static final long DAY
Const time value HOUR_24 = 86,400,000ms = 24 hr
USAGE: long timeToWait = org.jutil.TTime.HOUR_24;

See Also:
Constant Field Values

WEEK

public static final long WEEK
Const time value WEEK = 604,800,000ms = 1 week
USAGE: long timeToWait = org.jutil.TTime.WEEK;

See Also:
Constant Field Values
Constructor Detail

TTime

public TTime()
Ensure that no one can create instances of this Class.

Method Detail

create

public static java.sql.Time create(java.lang.String s)
create from a string in JDBC Timestamp escape format to a Time value usage: TTime.create("1999-02-02 08:30:00.0");

Parameters:
s - time in format "yyyy-mm-dd hh:mm:ss.fffffffff"
Returns:
corresponding Time

create

public static java.sql.Time create(int year,
                                   int month,
                                   int day,
                                   int hrs,
                                   int min)

create

public static java.sql.Time create(int year,
                                   int month,
                                   int day,
                                   int hrs,
                                   int min,
                                   int sec)

getTime

public static final long getTime()
USAGE: org.jutil.TTime.getTime();


getUniqueTime

public static final long getUniqueTime()
USAGE: org.jutil.TTime.getUniqueTime();

Returns:
long

tick

public static final void tick(long ms)
USAGE: org.jutil.TTime.tick(long ms)

Parameters:
ms -

timeElaspsedToString

public static final java.lang.String timeElaspsedToString(long time)
USAGE: org.jutil.TTime.timeElaspsed(long time); long timeStarted = getTime(); { // do some operation code here ... } System.out.println("operation" + timeElaspsedToString(timeTaken)); result: "operation took [10]sec [10000]ms" return a formatted string representing the seconds and milliseconds elasped since the time parameter


formatTimeElaspsedToString

public static final java.lang.String formatTimeElaspsedToString(long time)

timeElaspsed

public static final long timeElaspsed(long time)
USAGE: org.jutil.TTime.timeElaspsed(long time); long timeStarted = getTime(); { // do some operation code here ... } long timeTaken = timeElaspsed(timeStarted); System.out.println(" operation took "+timeTaken+"ms"); return a long representing the milliseconds elasped since the time parameter


toSimpleDateFormat

public static final java.lang.String toSimpleDateFormat(long time,
                                                        java.lang.String format)
USAGE: org.jutil.TTime.toSimpleDateFormat(long time, final String format); org.jutil.TTime.toSimpleDateFormat(time, "dd MM yyyy");


toSimpleString

public static final java.lang.String toSimpleString(long time)
USAGE: org.jutil.TTime.toSimpleString(long time);


main

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

toGMTString

public static final java.lang.String toGMTString(long time)
USAGE: org.jutil.TTime.toGMTString(long time); formats long time to cookie GMT String
Wed, 01 Jan 2020 12:00:00 GMT


toISO8061DateTimeString

public static final java.lang.String toISO8061DateTimeString(long time)
USAGE: org.jutil.TTime.toISO8061DateTimeString(long time); formats long time to to ISO8061 DateTime String
"yyyy-MM-ddTHH:mm:ss" => 2007-04-03T20:56:13


toISO8061DateTimeString

public static final java.lang.String toISO8061DateTimeString(long time,
                                                             boolean incTimeZone)
damm this should be ISO8601 USAGE: org.jutil.TTime.toISO8061DateTimeString(long time, boolean incTimeZone); formats long time to to ISO8061 DateTime String with timezone
#NOTE Time zone portion has NOT been tested "yyyy-MM-ddTHH:mm:ss" => 2007-04-03T20:56:13 "yyyy-MM-ddTHH:mm:ss:zz" => 2007-04-03T20:56:13:GMT+10:00


toISO8061DateTimeString

public static final java.lang.String toISO8061DateTimeString(java.util.Calendar cal,
                                                             boolean incTimeZone)

toISO8061DateTimeString

public static final java.lang.String toISO8061DateTimeString(java.util.Date date,
                                                             boolean incTimeZone)

parseISO8061DateTimeString

public static final java.util.Calendar parseISO8061DateTimeString(java.lang.String value)
                                                           throws java.lang.IndexOutOfBoundsException,
                                                                  java.lang.IllegalArgumentException
parse format expected "yyyy-MM-dd'T'HH:mm:ss" "yyyy-MM-ddTHH:mm:ss" => 2007-04-03T20:56:13 "yyyy-MM-ddTHH:mm:ss:zz" => 2007-04-03T20:56:13:GMT+10:00

Throws:
java.lang.IndexOutOfBoundsException
java.lang.IllegalArgumentException

toString

public static final java.lang.String toString(long time)
USAGE: org.jutil.TTime.toString(long time);


toSecString

public static final java.lang.String toSecString(long time)
USAGE: org.jutil.TTime.toSecString(long time);


getAccurateTime

public static final long getAccurateTime(java.sql.Timestamp timestamp)
USAGE: org.jutil.TTime.getAccurateTime( Timestamp timestamp );


isTimestampInRange

public static final boolean isTimestampInRange(java.sql.Timestamp test,
                                               java.sql.Timestamp start,
                                               java.sql.Timestamp end)
USAGE: org.jutil.TTime.isTimestampInRange( Timestamp test, Timestamp start, Timestamp end );