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 boolean
betweenInDay(Date date, Date start, Date end)
check id a date in between two other date, but date in range.static Calendar
convertEndOfDay(Calendar cal)
static Calendar
convertRemoveAfterDay(Calendar cal)
static Calendar
convertRemoveAfterHour(Calendar cal)
static Calendar
convertRemoveAfterMinutes(Calendar cal)
static Calendar
convertRemoveAfterMonth(Calendar cal)
static LocalDateTime
convertToLocalDateTimeViaInstant(Date dateToConvert)
static LocalDate
convertToLocalDateViaInstant(Date dateToConvert)
static String
exportAgenda(ContentContext ctx, MenuElement agendaPage, Date startDate, Date endDate)
static int
getAge(Date born)
static Calendar
getCalendar(Date date)
static long
getDaysDistance(LocalDate date1, LocalDate date2)
get the distance between 2 dates in daystatic int
getDaysDistance(Date date1, Date date2)
get the distance between 2 dates in daystatic DateFormat
getDefaultDateFormat(ContentContext ctx)
return the date format defined in the system, depend of rendering mode, globalContext config or default java config.static boolean
isAfterForDay(Date date, Date ref)
check if date is after other date.static boolean
isAfterOrEqualForDay(Date date, Date ref)
check if date is after other date, if the day is the same it is ok.static boolean
isBeforeForDay(Date date, Date ref)
check if date is after other date, if the day is the same it is ok.static boolean
isBeforeOrEqualForDay(Date date, Date ref)
check if date is after other date, if the day is the same it is ok.static boolean
isEqualForDay(Date date, Date ref)
check if date is after other date, if the day is the same it is ok.static void
main(String[] args)
static Date
toStartWeek(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:
IOException
FileNotFoundException
-
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)
-
-