Package org.javlo.helper
Class TimeHelper
- java.lang.Object
-
- org.javlo.helper.TimeHelper
-
public class TimeHelper extends Object
-
-
Constructor Summary
Constructors Constructor Description TimeHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanbetweenInDay(Date date, Date start, Date end)check id a date in between two other date, but date in range.static CalendarconvertEndOfDay(Calendar cal)static CalendarconvertRemoveAfterDay(Calendar cal)static CalendarconvertRemoveAfterHour(Calendar cal)static CalendarconvertRemoveAfterMinutes(Calendar cal)static CalendarconvertRemoveAfterMonth(Calendar cal)static LocalDateTimeconvertToLocalDateTimeViaInstant(Date dateToConvert)static LocalDateconvertToLocalDateViaInstant(Date dateToConvert)static StringexportAgenda(ContentContext ctx, MenuElement agendaPage, Date startDate, Date endDate)static intgetAge(Date born)static CalendargetCalendar(Date date)static longgetDaysDistance(LocalDate date1, LocalDate date2)get the distance between 2 dates in daystatic intgetDaysDistance(Date date1, Date date2)get the distance between 2 dates in daystatic DateFormatgetDefaultDateFormat(ContentContext ctx)return the date format defined in the system, depend of rendering mode, globalContext config or default java config.static booleanisAfterForDay(Date date, Date ref)check if date is after other date.static booleanisAfterOrEqualForDay(Date date, Date ref)check if date is after other date, if the day is the same it is ok.static booleanisBeforeForDay(Date date, Date ref)check if date is after other date, if the day is the same it is ok.static booleanisBeforeOrEqualForDay(Date date, Date ref)check if date is after other date, if the day is the same it is ok.static booleanisEqualForDay(Date date, Date ref)check if date is after other date, if the day is the same it is ok.static voidmain(String[] args)static DatetoStartWeek(Date date)set the date at the first day of the week.o
-
-
-
Field Detail
-
NO_DATE
public static final Date NO_DATE
-
-
Method Detail
-
toStartWeek
public static Date toStartWeek(Date date)
set the date at the first day of the week.o- Parameters:
date-- Returns:
-
isAfterOrEqualForDay
public static boolean isAfterOrEqualForDay(Date date, Date ref)
check if date is after other date, if the day is the same it is ok.
-
isAfterForDay
public static boolean isAfterForDay(Date date, Date ref)
check if date is after other date.
-
isBeforeOrEqualForDay
public static boolean isBeforeOrEqualForDay(Date date, Date ref)
check if date is after other date, if the day is the same it is ok.
-
isBeforeForDay
public static boolean isBeforeForDay(Date date, Date ref)
check if date is after other date, if the day is the same it is ok.
-
isEqualForDay
public static boolean isEqualForDay(Date date, Date ref)
check if date is after other date, if the day is the same it is ok.
-
betweenInDay
public static boolean betweenInDay(Date date, Date start, Date end)
check id a date in between two other date, but date in range.- Parameters:
date-start-end-- Returns:
-
getDefaultDateFormat
public static DateFormat getDefaultDateFormat(ContentContext ctx) throws FileNotFoundException, IOException
return the date format defined in the system, depend of rendering mode, globalContext config or default java config.- Parameters:
ctx- current content- Returns:
- Throws:
IOExceptionFileNotFoundException
-
exportAgenda
public static String exportAgenda(ContentContext ctx, MenuElement agendaPage, Date startDate, Date endDate) throws Exception
- Throws:
Exception
-
getDaysDistance
public static int getDaysDistance(Date date1, Date date2)
get the distance between 2 dates in day- Parameters:
date1-date2-- Returns:
-
main
public static void main(String[] args)
-
getDaysDistance
public static long getDaysDistance(LocalDate date1, LocalDate date2)
get the distance between 2 dates in day- Parameters:
date1-date2-- Returns:
-
getAge
public static int getAge(Date born)
-
convertToLocalDateViaInstant
public static LocalDate convertToLocalDateViaInstant(Date dateToConvert)
-
convertToLocalDateTimeViaInstant
public static LocalDateTime convertToLocalDateTimeViaInstant(Date dateToConvert)
-
-