Package de.mhus.lib.core
Class MDate
- java.lang.Object
-
- java.util.Date
-
- de.mhus.lib.core.MDate
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<Date>
public class MDate extends Date
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DateFormatgetLocaleDateFormatter(Locale locale)Returns a locale specific date formatter.static booleanisEarlierAs(Date a, Date b)static booleanisLaterAs(Date a, Date b)static booleanisWeekend(Date date)static booleanisWorkDay(Date date)static intlastDayOfMonth(int month, int year)Calculate the last day of the defined month.CalendartoCalendar()static DatetoDate(Object in, Date def)static DatetoDate(Object in, Date def, Locale locale)static DatetoDateOnly(Date date)static StringtoDateString(Date date)static StringtoDateString(Date date, Locale locale)static StringtoDateTimeSecondsString(Date date)static StringtoDateTimeSecondsString(Date date, Locale locale)static StringtoDateTimeSecondsString(Date date, Locale locale, TimeZone tz)static StringtoDateTimeString(Date date)static StringtoDateTimeString(Date date, Locale locale)static StringtoDateTimeString(Date date, Locale locale, TimeZone tz)static StringtoFileFormat(Calendar date)yyyyMMddHHmmssstatic StringtoFileFormat(Date date)yyyyMMddHHmmssstatic StringtoHttpHeaderDate(long date)static StringtoHttpHeaderDate(Date date)static StringtoIso8601(long timestamp)static StringtoIso8601(Calendar date)yyyy-MM-ddTHH:mm:ssstatic StringtoIso8601(Calendar date, TimeZone tz)static StringtoIso8601(Date date)yyyy-MM-ddTHH:mm:ssstatic StringtoIso8601(Date date, TimeZone tz)static StringtoIsoDate(Calendar _in)Calendar to iso date: yyyy-mm-ddstatic StringtoIsoDate(Date _in)Returns the date in iso format: yyyy-mm-ddstatic StringtoIsoDateTime(long timeStamp)Calendar to iso date: yyyy-mm-ddstatic StringtoIsoDateTime(Calendar _in)static StringtoIsoDateTime(Date _in)Returns the date in iso time format: yyyy-mm-dd HH:mm:ss.SSSDatetoSqlDate()TimetoSqlTime()TimestamptoSqlTimestamp()StringtoString()static StringtoString(String format, Date date)static StringtoTimeSecondsString(Date date)static StringtoTimeSecondsString(Date date, TimeZone tz)static StringtoTimeString(Date date)static StringtoTimeString(Date date, TimeZone tz)static Stringtransform(String format, String date, Date def)-
Methods inherited from class java.util.Date
after, before, clone, compareTo, equals, from, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toInstant, toLocaleString, UTC
-
-
-
-
Field Detail
-
NULL_DATE
public static final Date NULL_DATE
-
-
Method Detail
-
toSqlDate
public Date toSqlDate()
-
toSqlTime
public Time toSqlTime()
-
toSqlTimestamp
public Timestamp toSqlTimestamp()
-
toCalendar
public Calendar toCalendar()
-
isWorkDay
public static boolean isWorkDay(Date date)
-
isWeekend
public static boolean isWeekend(Date date)
-
toIso8601
public static String toIso8601(Date date)
yyyy-MM-ddTHH:mm:ss- Parameters:
date-- Returns:
- the formatted date as string
-
toIso8601
public static String toIso8601(long timestamp)
-
toDateTimeSecondsString
public static String toDateTimeSecondsString(Date date, Locale locale, TimeZone tz)
-
getLocaleDateFormatter
public static DateFormat getLocaleDateFormatter(Locale locale)
Returns a locale specific date formatter.- Parameters:
locale- the locale or null for default locale- Returns:
- date formatter
-
toFileFormat
public static String toFileFormat(Date date)
yyyyMMddHHmmss- Parameters:
date-- Returns:
- the formatted date as string
-
toIsoDate
public static String toIsoDate(Date _in)
Returns the date in iso format: yyyy-mm-dd- Parameters:
_in-- Returns:
- the formatted date as string
-
toIsoDateTime
public static String toIsoDateTime(Date _in)
Returns the date in iso time format: yyyy-mm-dd HH:mm:ss.SSS- Parameters:
_in-- Returns:
- the formatted date as string
-
toIsoDateTime
public static String toIsoDateTime(long timeStamp)
Calendar to iso date: yyyy-mm-dd- Parameters:
timeStamp-- Returns:
- the formatted date as string
-
toIsoDate
public static String toIsoDate(Calendar _in)
Calendar to iso date: yyyy-mm-dd- Parameters:
_in-- Returns:
- the formatted date as string
-
toIso8601
public static String toIso8601(Calendar date)
yyyy-MM-ddTHH:mm:ss- Parameters:
date-- Returns:
- the formatted date as string
-
toFileFormat
public static String toFileFormat(Calendar date)
yyyyMMddHHmmss- Parameters:
date-- Returns:
- the formatted date as string
-
lastDayOfMonth
public static int lastDayOfMonth(int month, int year)Calculate the last day of the defined month.- Parameters:
month- 0 - 11year- YYYY- Returns:
- The last day of the month 1 - 31
-
toHttpHeaderDate
public static String toHttpHeaderDate(long date)
-
-