Package com.logicaldoc.core.i18n
Class DateBean
- java.lang.Object
-
- java.util.Date
-
- com.logicaldoc.core.i18n.DateBean
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Date>
public class DateBean extends Date
This class converts a date into some formats.- Version:
- 1.1
- Author:
- Michael Scholz, Sebastian Stein
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DateBean()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
convertDate(String formatIn, String formatOut, String dateIn)
Converts a string containing a date between the given formats.static Date
dateFromCompactString(String compactString)
This method creates the Date object for a compact string in the format yyyyMMdd HH:mm:ss or yyyyHHdd.static String
toCompactString()
This method returns the current date in the format yyyyMMdd HH:mm:ss.static String
toCompactString(String date, String dateFormat, String lang)
This method formats a string with format dd.mm.yyyy into format yyyymmdd.static String
toCompactString(Date date)
This method formats a a date into format yyyymmdd.-
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, toString, UTC
-
-
-
-
Method Detail
-
toCompactString
public static String toCompactString()
This method returns the current date in the format yyyyMMdd HH:mm:ss.- Returns:
- current date in format yyyyMMdd HH:mm:ss
-
dateFromCompactString
public static Date dateFromCompactString(String compactString)
This method creates the Date object for a compact string in the format yyyyMMdd HH:mm:ss or yyyyHHdd.- Parameters:
compactString
- compact text representation of the date- Returns:
- the date
-
toCompactString
public static String toCompactString(Date date)
This method formats a a date into format yyyymmdd.- Parameters:
date
- the date to be converted- Returns:
- a string containing the converted date
-
toCompactString
public static String toCompactString(String date, String dateFormat, String lang)
This method formats a string with format dd.mm.yyyy into format yyyymmdd.- Parameters:
date
- string containing the date to be converteddateFormat
- format of the datelang
- from which language it should be converted- Returns:
- a string containing the converted date
-
convertDate
public static String convertDate(String formatIn, String formatOut, String dateIn)
Converts a string containing a date between the given formats.- Parameters:
formatIn
- current format of the stringformatOut
- format the string should be converted todateIn
- the string containing a date in the formatIn- Returns:
- returns the converted string in the formatOut
-
-