Package com.easydesk.tools
Class Format
java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
org.apache.velocity.tools.generic.LocaleConfig
org.apache.velocity.tools.generic.FormatConfig
org.apache.velocity.tools.generic.DateTool
com.easydesk.tools.Format
- All Implemented Interfaces:
Serializable
public class Format
extends org.apache.velocity.tools.generic.DateTool
Takes a date in any format and converts it to the desired format
TODO : remove DateTool dependency
TODO : remove DateTime
- Author:
- 조 영 호
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDOCUMENT ME!static final StringThe default date format which we'll try to parse with if a format is not specified.final String[]입력 Format 들의 종류protected LocaleThe Locale to be used, if the Resource could not be found in one of the Locales specified in the Browser's language preferences.static final StringFull Combined DateTime formatstatic final StringFull Combined DateTime formatstatic final StringThe ISO date format for data attribute value displaystatic final Stringhuman friendly patten with full date time for display purposestatic final StringThe ISO date/time format that we accept when users enter/modify data and system datastatic final StringThe time format for data attribute value displaystatic final Stringstatic final long근사 3 년 *static final long근사 1 달 *static final long근사 3 달 *static final long근사 1 년 *static final String입력 DateAttributeValue 값에 설정이 되면 현재시간으로 설정하는 keystatic final intQuertly Constantfinal StringItem 을 저장할 때 사용하는 DATETIME format "jettiger.datetime.format" 를 key 로 properties file 에서 설정가능 default 는 ISO_DATETIME_PATTERNstatic final PatternSystem Date Patternstatic final long24시간Fields inherited from class org.apache.velocity.tools.generic.DateTool
TIMEZONE_KEYFields inherited from class org.apache.velocity.tools.generic.FormatConfig
DEFAULT_FORMAT, FORMAT_KEYFields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondateToString(Date date) Deprecated.use LuceneUtils.dateToStringformat(SimpleDateFormat format, Date date) Formats the date according to the passed in SimpleDateFormat This is generally used with SRT.getDateFormat() and in the templates it looks something like this: $format.getDate($jettigerR.DateFormat, $item.CreatedDate)formatCalendarDate(Long time) yyyyMMddTHHmmssZformatCalendarDate(Date date) yyyyMMddTHHmmssZformatCalendarDate(Date date, boolean dateOnly) yyyyMMddTHHmmssZstatic StringformatHttpDate(Date date) Formats a java Date according to rfc 1123, the rfc standard for dates in http.int두 Date 간의 날짜를 구한다.intDOCUMENT ME!DOCUMENT ME!System Default Format Default is "yyyy-MM-dd HH:mm", 변경을 원하면 "jettiger.datetime.format" key 로 Configuration 에서 변경final StringgetInfoDate(String format, Date date) 생성한 날을 구한다.final Date오늘 새벽 0시 를 가지고 온다final DategetMidNight(Date date) 0시 를 가지고 온다intgetMonthCountInARange(Date startDate, Date endDate) 두 시간간의 diff month 값으로 구한다.final Date이번달 시작일 0시 를 가지고 온다final DategetMonthStartDate(Date date) 달 시작일 0시 를 가지고 온다getNow()JetTigerConstants.SYSTEM_DATETIME_FORMAT 에 맞추어 지금을 구한다.Formats the current date according to the passed in format Uses SimpleDateFormat to do its magic.Formats the current date according to the passed in format Uses SimpleDateFormat to do its magic.getNow(SimpleDateFormat format) Formats the current date according to the passed in format Uses SimpleDateFormat to do its magic.mainly for email subject 시간 표기getPassedTimeAsString(Date date) 현재시간에서 차이를 구한다.getPassedTimeAsString(Date date, Date reference) 현재시간에서 차이를 구한다.Date[]Deprecated.use timeScope.getRange() method directlyDate[]Deprecated.use timeScope.getRange() method directlygetRangeAsString(TimeScope timeScope, boolean includeOffset) getRangeAsString(TimeScope timeScope, Date date, boolean includeOffset) DOCUMENT ME!getSafeDate(String string) System Iso Date format 을 찾는다.voidDOCUMENT ME!later(int year, int month, int day) laterDate(int year, int month, int day) DOCUMENT ME!DOCUMENT ME!DOCUMENT ME!JetTigerConstants.SYSTEM_DATETIME_FORMAT 에 맞추어 한달뒤JetTigerConstants.SYSTEM_DATETIME_FORMAT 에 맞추어 일주일뒤JetTigerConstants.SYSTEM_DATETIME_FORMAT 에 맞추어 일년뒤static Stringspecial method yyyyMMddHHmm 을 yyyy-MM-dd HH:mm 으로 변환static StringreFormatDateOnly(String string) special method yyyyMMddHHmm 을 yyyy-MM-dd으로 변환voidrefresh()DOCUMENT ME!먼저 timezone 이 있으면 처리한다.먼저 timezone 이 있으면 처리한다.먼저 timezone 이 있으면 처리한다.toDateFromAttributeValue(String timestamp) JetTigerConstants.DATE_FORMAT 을 먼저 처리한다. toDate 는 JetTigerConstants.DATE_FORMAT 를 세번째에 처리한다.Methods inherited from class org.apache.velocity.tools.generic.DateTool
configure, format, format, format, format, format, format, format, get, get, getCalendar, getDate, getDateFormat, getDateFormat, getDay, getDay, getMonth, getMonth, getSystemCalendar, getSystemDate, getSystemTime, getTimeZone, getValue, getValue, getValue, getYear, getYear, setTimeZone, toCalendar, toCalendar, toCalendar, toCalendar, toCalendar, toDate, toDate, toDate, toDate, toDate, toDate, toLocalizedPattern, toStringMethods inherited from class org.apache.velocity.tools.generic.FormatConfig
setFormatMethods inherited from class org.apache.velocity.tools.generic.LocaleConfig
getLocale, setLocale, toLocaleMethods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
-
Field Details
-
QUARTLY
public static final int QUARTLYQuertly Constant- See Also:
-
TWENTY_FOUR_HOURS
public static final long TWENTY_FOUR_HOURS24시간- See Also:
-
MILLIS_PER_APPR_MONTH
public static final long MILLIS_PER_APPR_MONTH근사 1 달 * -
MILLIS_PER_APPR_QUART
public static final long MILLIS_PER_APPR_QUART근사 3 달 * -
MILLIS_PER_APPR_YEAR
public static final long MILLIS_PER_APPR_YEAR근사 1 년 *- See Also:
-
MILLIS_PER_APPR_3YEAR
public static final long MILLIS_PER_APPR_3YEAR근사 3 년 *- See Also:
-
NOW_MARK
입력 DateAttributeValue 값에 설정이 되면 현재시간으로 설정하는 key- See Also:
-
ISO_DATE_PATTERN
The ISO date format for data attribute value display- See Also:
-
SYSTEM_ISO_DATE_PATTERN
System Date Pattern -
ISO_DATETIME_PATTERN
The ISO date/time format that we accept when users enter/modify data and system data- See Also:
-
ISO_COMBINED_DATETIME_DISPLAY_PATTERN
Full Combined DateTime format- See Also:
-
ISO_COMBINED_DATETIME_PATTERN
Full Combined DateTime format- See Also:
-
ISO_DATETIME_DISPLAY_PATTERN
human friendly patten with full date time for display purpose- See Also:
-
LUCENE_DATETIME_PATTERN
- See Also:
-
ISO_SHORT_TIME_PATTERN
The time format for data attribute value display- See Also:
-
CALENDAR_DATE_PATTERN
DOCUMENT ME!- See Also:
-
DATE_FORMAT
The default date format which we'll try to parse with if a format is not specified. 또한 item attribute value 의 date attribute value format 이다. 모든 date attribute value 값은 Locale 정보를 가지고 database 에 저장된다. display 시 항상 formater 의 정보를 이용하여 reformat 하여야 한다. 왜냐하면 미국에서 등록한 정보를 미국에서 볼때, 한국에서 볼때 date 를 변환하여야 한다- See Also:
-
SYSTEM_DATETIME_FORMAT
Item 을 저장할 때 사용하는 DATETIME format "jettiger.datetime.format" 를 key 로 properties file 에서 설정가능 default 는 ISO_DATETIME_PATTERN- See Also:
-
DATETIME_FORMATS
입력 Format 들의 종류 -
DEFAULT_LOCALE
The Locale to be used, if the Resource could not be found in one of the Locales specified in the Browser's language preferences.
-
-
Constructor Details
-
Format
public Format()Constructor does initialization stuff
-
-
Method Details
-
init
DOCUMENT ME!- Parameters:
obj- DOCUMENT ME!
-
refresh
public void refresh()DOCUMENT ME! -
getDefaultLocale
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getFormat
System Default Format Default is "yyyy-MM-dd HH:mm", 변경을 원하면 "jettiger.datetime.format" key 로 Configuration 에서 변경- Overrides:
getFormatin classorg.apache.velocity.tools.generic.FormatConfig
-
format
Formats the date according to the passed in SimpleDateFormat This is generally used with SRT.getDateFormat() and in the templates it looks something like this: $format.getDate($jettigerR.DateFormat, $item.CreatedDate)- Throws:
ParseException
-
format
- Parameters:
format- DOCUMENT ME!date- DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
ParseException- DOCUMENT ME!
-
formatHttpDate
Formats a java Date according to rfc 1123, the rfc standard for dates in http.- Parameters:
date- The Date to format- Returns:
- A String represeentation of the date
-
formatCalendarDate
yyyyMMddTHHmmssZ -
formatCalendarDate
yyyyMMddTHHmmssZ- Parameters:
date-
-
formatCalendarDate
yyyyMMddTHHmmssZ- Parameters:
date-dateOnly-
-
getInfoDate
생성한 날을 구한다. 생성시각이 오늘이면 HH:mm:ss 의 형태로 , 오늘 이전이면 주어진 format 형태의 날짜를 구한다.- Parameters:
format- Stringdate- Date- Returns:
- String
- Throws:
Exception
-
toDateFromAttributeValue
JetTigerConstants.DATE_FORMAT 을 먼저 처리한다. toDate 는 JetTigerConstants.DATE_FORMAT 를 세번째에 처리한다.- Parameters:
timestamp-- Returns:
- date
-
toDate
먼저 timezone 이 있으면 처리한다. 없으면 JetTigerConstants.SYSTEM_DATETIME_FORMAT JetTigerConstants.DATE_FORMAT, JetTigerConstants.ISO_DATE_PATTERN, JetTigerConstants.LUCENE_DATETIME_PATTERN 의 순서로 처리한다.- Parameters:
timestamp-- Returns:
- date
-
toDate
먼저 timezone 이 있으면 처리한다. 없으면 JetTigerConstants.SYSTEM_DATETIME_FORMAT JetTigerConstants.DATE_FORMAT, JetTigerConstants.ISO_DATE_PATTERN, JetTigerConstants.LUCENE_DATETIME_PATTERN 의 순서로 처리한다.- Parameters:
timestamp-locale-- Returns:
- date
-
toDate
먼저 timezone 이 있으면 처리한다. 없으면 JetTigerConstants.SYSTEM_DATETIME_FORMAT JetTigerConstants.DATE_FORMAT, JetTigerConstants.ISO_DATE_PATTERN, JetTigerConstants.LUCENE_DATETIME_PATTERN 의 순서로 처리한다.- Parameters:
timestamp-locale-zone-- Returns:
- date
-
getNowAsShort
mainly for email subject 시간 표기 -
getNow
JetTigerConstants.SYSTEM_DATETIME_FORMAT 에 맞추어 지금을 구한다.- Throws:
ParseException
-
getNow
Formats the current date according to the passed in format Uses SimpleDateFormat to do its magic.- Throws:
ParseException
-
getNow
Formats the current date according to the passed in format Uses SimpleDateFormat to do its magic.- Throws:
ParseException
-
getNow
Formats the current date according to the passed in format Uses SimpleDateFormat to do its magic.- Throws:
ParseException
-
getDays
두 Date 간의 날짜를 구한다. 단순히 24 시간으로 나눈 작업임으로 date 안에 시간이 들어 있을 경우 날짜 계산이 틀릴수 있다.- Parameters:
startDate-endDate-
-
getMidNight
오늘 새벽 0시 를 가지고 온다- Returns:
- Date
-
getMidNight
0시 를 가지고 온다- Returns:
- Date
-
getMonthStartDate
이번달 시작일 0시 를 가지고 온다- Returns:
- Date
-
getMonthStartDate
달 시작일 0시 를 가지고 온다- Returns:
- Date
-
oneYearLater
JetTigerConstants.SYSTEM_DATETIME_FORMAT 에 맞추어 일년뒤- Throws:
ParseException
-
oneMonthLater
JetTigerConstants.SYSTEM_DATETIME_FORMAT 에 맞추어 한달뒤- Throws:
ParseException
-
oneWeekLater
JetTigerConstants.SYSTEM_DATETIME_FORMAT 에 맞추어 일주일뒤- Throws:
ParseException
-
laterDate
DOCUMENT ME!- Parameters:
date- DOCUMENT ME!year- DOCUMENT ME!month- DOCUMENT ME!day- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
laterDate
DOCUMENT ME!- Parameters:
year- DOCUMENT ME!month- DOCUMENT ME!day- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
laterDate
- Parameters:
date-delay- second
-
oneHourLater
DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
ParseException- DOCUMENT ME!
-
later
- Returns:
- JetTigerConstants.SYSTEM_DATETIME_FORMAT String
-
getDDay
DOCUMENT ME!- Parameters:
date- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
reFormat
special method yyyyMMddHHmm 을 yyyy-MM-dd HH:mm 으로 변환 -
reFormatDateOnly
special method yyyyMMddHHmm 을 yyyy-MM-dd으로 변환 -
getSafeDate
System Iso Date format 을 찾는다.- Parameters:
string-- Returns:
- yyyy-MM-dd formatted string
-
dateToString
Deprecated.use LuceneUtils.dateToStringyyyyMMddHHmmSSS 으로- Returns:
- search formatted String
-
getPassedTimeAsString
현재시간에서 차이를 구한다.- Parameters:
date-
-
getPassedTimeAsString
현재시간에서 차이를 구한다.- Parameters:
date-reference-
-
getRange
Deprecated.use timeScope.getRange() method directly- Parameters:
timeScope- daily, weekly, monthly ...- Returns:
- Date array [ min date, max date ]
-
getRange
Deprecated.use timeScope.getRange() method directly- Parameters:
timeScope- daily, weekly, monthly ...date-includeOffset- Monthly 인 경우 offset 을 포함하면 6주 를 처리- Returns:
- Date array [ min date, max date ]
-
getRangeAsString
- Parameters:
timeScope- daily, weekly, monthly ...includeOffset-- Returns:
- range String as [min max) format
- See Also:
-
getRangeAsString
DOCUMENT ME!- Parameters:
timeScope- DOCUMENT ME!date- DOCUMENT ME!includeOffset- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getMonthCountInARange
두 시간간의 diff month 값으로 구한다.- Parameters:
startDate-endDate-
-
truncate
- Parameters:
obj- calendar or datefield-
-
add
- Parameters:
date-field-amount-
-