Package org.xbricks.common.utils.types
Class DateTimeUtils
java.lang.Object
org.xbricks.common.utils.types.DateTimeUtils
some utilites
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalDateconvertToLocalDate(Date date) static LocalTimeconvertToLocalTime(Date date) static DatecreateDate(int day, int month, int year) create java.util.Date with parameter day,month year without time Month value is 1-based.static DateDate2DateWithNoTime(Date date) setzt Zeitanteil eines Datums auf 00:00:00.000static StringDate2GermanString(Date date) converts date into String with dd.MM.yyyystatic longliefert zu einem Datum ohne Uhrzeit den long Wert.static StringDate2MonthYearString(Date date) converts date into String with month - yyyy like march - 2012static StringDate2String(Date date) converts date into String with dd.MM.yyyystatic longDateGerman2Long(String germanDateString) Konvertiert einen Datum String im deutschen Format in einen long Wert wenn der String nicht diesen Konventionen entspricht wird der Wert 0l zurückgeliefertstatic Stringreturn Sting and escape null to blankstatic Timewenn time null ist wird ein Timewert mit 00:00:00 zurückgeliefert.static Stringfloat2time(float f) Deprecated.static StringformatDate(Date date) static StringformatTime(Time time) static intreturn day of given datestatic StringgetHeute()return current date String in german date format dd.MM.yyyystatic intGibt die Stunden eines Time objekts zurück.static intgetMinutes(Time time) Gibt die Minuten eines Time Objekts zurück.static intreturn month of given datestatic StringgetMonthName(int month) gibt den Monatsnamen zurück, wobei 1 = Janstatic floatgetTimePeriod(Time start, Time end) berechnet eine Zeitperiode und gibt den Wert als float zurückstatic floatgetWorkingTime(Time start, Time end, Time breakTime) berechnet Arbeitszeit abzüglich Pausezeit und gibt diesen als float zurück;static intreturn current yearstatic StringHours2TimeString(float f) Dezimale Zeitangabe in HH:mm:ss umrechnen, mit HH:mm als Stringstatic booleanisDate1BehindDate2(Date date1, Date date2) liefert true zurück, wenn das Datum date1 hinter dem Datum date2 liegtstatic booleanisDateExpired(Date date) liefert true zurück, wenn das Datum date (ohne Uhrzeit) in der Vergangenheit liegtstatic booleanisEmptyOrNull(String str) check if entry is empty empty values are: null "" 00:00 00:00:00static booleanisEmptyOrNull(Time time) check if entry is empty empty values are: null "" 00:00 00:00:00static booleanisEmptyString(String str) check if entry is empty empty values are: "" and nullstatic booleanisEqualDate(Date date1, Date date2) liefert true zurück, wenn das Datum ohne Uhrzeit gleich iststatic booleanisGermaDatenFormatLong(String germanDateString) liefert true zurück, wenn das Datumsformat [d]d.[m]m.yyyy vorliegtstatic booleanisGermanDateFormatShort(String germanDateString) liefert true zurück, wenn das Datumsformat [d]d.[m]m.yy vorliegtstatic booleanisIntervallAEqualIntervallB(String tA0, String tA1, String tB0, String tB1) Deprecated.static booleanisIntervallAEqualIntervallB(Time tA0, Time tA1, Time tB0, Time tB1) Deprecated.static booleanisIntervallAInsideIntervallB(String tA0, String tA1, String tB0, String tB1) prüft ob Intervall tA0 - tB1 innerhalb des Intervall tB0 - tB1static booleanisIntervallAInsideIntervallB(Time tA0, Time tA1, Time tB0, Time tB1) Deprecated.static booleanisIntervallAOutsideIntervallB(String tA0, String tA1, String tB0, String tB1) Deprecated.static booleanisIntervallAOutsideIntervallB(Time tA0, Time tA1, Time tB0, Time tB1) Deprecated.static booleanisTimeInsideIntervall(String tx, String t0, String t1) Deprecated.static booleanisTimeInsideIntervall(Time tx, Time t0, Time t1) Deprecated.static booleanisTimeInsideOrEqualIntervall(Time tx, Time t0, Time t1) Deprecated.static StringparseToString(Time time) Liefert ein Time Objekt als String im Format HH:mmstatic DateString2Date(String dateStr) covert a Date-String (dd.MM.yy) to java.sql.Datestatic longString2Time(String time) static intthisDay()return current day (of Month)static intreturn last day of this monthstatic intreturn current month jan = 1, feb = 2 ...static intthisYear()return current yearstatic floatTime2hours(Time time) calculates the given time into hoursstatic longconverts the given time into long representing time in ms since 1.1.1970static StringTime2String(Time[] timT02, int i0) static longTimeString2long(String input) converts a time string hh[:MM[:ss]] into long returns with -1 if no valid formatstatic TimeTimeString2Time(String input) converts a time string hh[:MM[:ss]] into time returns with -1 if no valid formatstatic Longreturn long value of time 00:00:00
-
Constructor Details
-
DateTimeUtils
public DateTimeUtils()
-
-
Method Details
-
Date2String
converts date into String with dd.MM.yyyy -
Date2Long
liefert zu einem Datum ohne Uhrzeit den long Wert. -
formatDate
-
formatTime
-
Date2MonthYearString
converts date into String with month - yyyy like march - 2012 -
DateGerman2Long
Konvertiert einen Datum String im deutschen Format in einen long Wert wenn der String nicht diesen Konventionen entspricht wird der Wert 0l zurückgeliefert -
escNull
return Sting and escape null to blank -
getHeute
return current date String in german date format dd.MM.yyyy -
getMonth
return month of given date -
getDay
return day of given date -
getYear
return current year -
isEmptyString
check if entry is empty empty values are: "" and null -
isEmptyOrNull
check if entry is empty empty values are: null "" 00:00 00:00:00 -
isEmptyOrNull
check if entry is empty empty values are: null "" 00:00 00:00:00 -
Date2GermanString
converts date into String with dd.MM.yyyy -
isGermaDatenFormatLong
liefert true zurück, wenn das Datumsformat [d]d.[m]m.yyyy vorliegt -
isGermanDateFormatShort
liefert true zurück, wenn das Datumsformat [d]d.[m]m.yy vorliegt -
thisDay
public static int thisDay()return current day (of Month) -
thisLastDay
public static int thisLastDay()return last day of this month -
thisMonth
public static int thisMonth()return current month jan = 1, feb = 2 ...- Returns:
- int
-
thisYear
public static int thisYear()return current year -
Time2hours
calculates the given time into hours- Returns:
- hours (float)
-
TimeString2long
converts a time string hh[:MM[:ss]] into long returns with -1 if no valid format -
ZERO_TIME_LONG
return long value of time 00:00:00 -
TimeString2Time
converts a time string hh[:MM[:ss]] into time returns with -1 if no valid format -
Time2long
converts the given time into long representing time in ms since 1.1.1970- Returns:
- time in ms (long)
-
Time2String
-
String2Date
covert a Date-String (dd.MM.yy) to java.sql.Date -
String2Time
-
float2time
Deprecated.Dezimale Zeitangabe in HH:mm umrechnen, mit HH:mm als String- Parameters:
f- (mit Stunden als float-value)
-
Hours2TimeString
Dezimale Zeitangabe in HH:mm:ss umrechnen, mit HH:mm als String- Parameters:
f- (mit Stunden als float-value)
-
getMonthName
gibt den Monatsnamen zurück, wobei 1 = Jan -
getWorkingTime
berechnet Arbeitszeit abzüglich Pausezeit und gibt diesen als float zurück; -
getTimePeriod
berechnet eine Zeitperiode und gibt den Wert als float zurück -
escNull
wenn time null ist wird ein Timewert mit 00:00:00 zurückgeliefert. -
Date2DateWithNoTime
setzt Zeitanteil eines Datums auf 00:00:00.000 -
isEqualDate
liefert true zurück, wenn das Datum ohne Uhrzeit gleich ist -
isDate1BehindDate2
liefert true zurück, wenn das Datum date1 hinter dem Datum date2 liegt -
isDateExpired
liefert true zurück, wenn das Datum date (ohne Uhrzeit) in der Vergangenheit liegt -
createDate
create java.util.Date with parameter day,month year without time Month value is 1-based. e.g., 1 for January. -
isTimeInsideIntervall
Deprecated.Bitte nur noch JodaTime nutzen! prüft ob Zeit tx innerhalb des Intervalls t0 - t1 liegt- Returns:
- true, wenn innerhalb
-
isTimeInsideIntervall
Deprecated.Bitte nur noch JodaTime nutzen! prüft ob Timetx innerhalb des Intervalls t0 - t1 liegt - Returns:
- true, wenn innerhalb
-
isTimeInsideOrEqualIntervall
Deprecated.Bitte nur noch JodaTime nutzen! prüft ob Time- Returns:
- true, wenn nicht außerhalb
-
isIntervallAEqualIntervallB
@Deprecated public static boolean isIntervallAEqualIntervallB(String tA0, String tA1, String tB0, String tB1) Deprecated.Bitte nur noch JodaTime nutzen! prüft ob Intervall tA0 - tB1 gleich dem Intervall tB0 - tB1- Parameters:
tA0-tA1-tB0-tB1-
-
isIntervallAEqualIntervallB
@Deprecated public static boolean isIntervallAEqualIntervallB(Time tA0, Time tA1, Time tB0, Time tB1) Deprecated.Bitte nur noch JodaTime nutzen! prüft ob Intervall tA0 - tB1 gleich dem Intervall tB0 - tB1- Parameters:
tA0-tA1-tB0-tB1-
-
isIntervallAInsideIntervallB
prüft ob Intervall tA0 - tB1 innerhalb des Intervall tB0 - tB1- Parameters:
tA0-tA1-tB0-tB1-
-
isIntervallAInsideIntervallB
@Deprecated public static boolean isIntervallAInsideIntervallB(Time tA0, Time tA1, Time tB0, Time tB1) Deprecated.Bitte nur noch JodaTime nutzen! prüft ob Intervall tA0 - tA1 innerhalb des Intervall tB0 - tB1 liegt wobei eine Intervallgrenze von A auch identisch mit B sein kann- Parameters:
tA0-tA1-tB0-tB1-
-
isIntervallAOutsideIntervallB
@Deprecated public static boolean isIntervallAOutsideIntervallB(String tA0, String tA1, String tB0, String tB1) Deprecated.Bitte nur noch JodaTime nutzen! prüft ob Intervall tA0 - tB1 ausserhalb des Intervall tB0 - tB1- Parameters:
tA0-tA1-tB0-tB1-
-
isIntervallAOutsideIntervallB
@Deprecated public static boolean isIntervallAOutsideIntervallB(Time tA0, Time tA1, Time tB0, Time tB1) Deprecated.Bitte nur noch JodaTime nutzen! prüft ob Intervall tA0 - tB1 ausserhalb des Intervall tB0 - tB1- Parameters:
tA0-tA1-tB0-tB1-- Returns:
- true, wenn nicht ausserhalb
-
getHours
Gibt die Stunden eines Time objekts zurück.- Returns:
- stunden.
-
getMinutes
Gibt die Minuten eines Time Objekts zurück.- Returns:
- minuten.
-
parseToString
Liefert ein Time Objekt als String im Format HH:mm -
convertToLocalDate
-
convertToLocalTime
-