com.alarexgroup.m2mplf.util
Class DateTime

java.lang.Object
  extended by com.alarexgroup.m2mplf.util.DateTime
public class DateTime
extends java.lang.Object

Object for work with time. Combines properties of standard JAVAs classes Calendar and Date.
Allows get current time and transform form of Date, long (miliseconds) and DDMMRRRRhhmmssms
Objects is also possible to compare and change single parameters as houer, minutes...

Constructor Summary
DateTime()
          Returns object DateTime - includes current date and time
DateTime(java.util.Date d)
          Returns object DateTime - date and time set according to the type Date content.
DateTime(int day, int month, int year, int hour, int min, int sec, int ms)
          Returns object DateTime - date and time according to single parametrs
DateTime(long time)
          Returns object Datetime which includes date and time according to long type content (miliseconds)
 
Method Summary
 boolean after(DateTime d)
          Compares if object's date in parametr was before date
 boolean before(DateTime d)
          Compares if object's date in parametr was after date
 boolean equals(DateTime d)
          Detects if the dates were the same
 int getDay()
          Returns Day
static long getDelta()
           
 int getHour()
          Returns hour in 0..23 form
 int getMillisecond()
          Returns miliseconds
 int getMinute()
          Returns minute
 int getMonth()
          Returns month
static long getRealTimeInMilis()
           
 int getSecond()
          Returns seconds
 int getYear()
          Returns year
 void setDay(int day)
          Sets day
 void setHour(int hour)
          Sets hour
 void setMilliSecond(int ms)
          Sets milisecond
 void setMinute(int min)
          Sets Minute
 void setMonth(int month)
          Sets month
static void setRealDateTime(int day, int month, int year, int hour, int minute, int second, int milisecond)
          Nastaví skutečné datum a čas pro třídu DateTime
 void setSecond(int sec)
          Sets Second
 void setYear(int year)
          Sets year
 java.util.Date toDate()
          Convert DateTime into Date form
 long toLong()
          Convert DateTime into long type form - miliseconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateTime

public DateTime(java.util.Date d)
Returns object DateTime - date and time set according to the type Date content.

Parameters:
d - Date and time in Date form

DateTime

public DateTime()
Returns object DateTime - includes current date and time

DateTime

public DateTime(long time)
Returns object Datetime which includes date and time according to long type content (miliseconds)

Parameters:
l - time and date - miliseconds

DateTime

public DateTime(int day,
                int month,
                int year,
                int hour,
                int min,
                int sec,
                int ms)
Returns object DateTime - date and time according to single parametrs

Parameters:
day - 1..31
month - 1..12
year - 200x
hour - 0..23
min - 0..59
sec - 0..59
ms - 0..999
Method Detail

setRealDateTime

public static void setRealDateTime(int day,
                                   int month,
                                   int year,
                                   int hour,
                                   int minute,
                                   int second,
                                   int milisecond)
Nastaví skutečné datum a čas pro třídu DateTime

getDelta

public static long getDelta()

getRealTimeInMilis

public static long getRealTimeInMilis()

toLong

public long toLong()
Convert DateTime into long type form - miliseconds

Returns:
form in miliseconds

toDate

public java.util.Date toDate()
Convert DateTime into Date form

Returns:
Date form

getDay

public int getDay()
Returns Day

Returns:
day

getMonth

public int getMonth()
Returns month

Returns:
month

getYear

public int getYear()
Returns year

Returns:
year

getHour

public int getHour()
Returns hour in 0..23 form

Returns:
hour

getMinute

public int getMinute()
Returns minute

Returns:
minute

getSecond

public int getSecond()
Returns seconds

Returns:
seconds

getMillisecond

public int getMillisecond()
Returns miliseconds

Returns:
miliseconds

after

public boolean after(DateTime d)
Compares if object's date in parametr was before date

Parameters:
d - compared date
Returns:
TRUE - before

before

public boolean before(DateTime d)
Compares if object's date in parametr was after date

Parameters:
d - compared date
Returns:
TRUE - after date

equals

public boolean equals(DateTime d)
Detects if the dates were the same

Parameters:
d - compared date
Returns:
TRUE - the same

setHour

public void setHour(int hour)
Sets hour

Parameters:
hour -

setMinute

public void setMinute(int min)
Sets Minute

Parameters:
Minute -

setSecond

public void setSecond(int sec)
Sets Second

Parameters:
sec -

setMilliSecond

public void setMilliSecond(int ms)
Sets milisecond

Parameters:
ms -

setDay

public void setDay(int day)
Sets day

Parameters:
day -

setMonth

public void setMonth(int month)
Sets month

Parameters:
month -

setYear

public void setYear(int year)
Sets year

Parameters:
year -