本文整理匯總了Java中org.alfresco.util.CachingDateFormat.getDateOnlyFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java CachingDateFormat.getDateOnlyFormat方法的具體用法?Java CachingDateFormat.getDateOnlyFormat怎麽用?Java CachingDateFormat.getDateOnlyFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.alfresco.util.CachingDateFormat
的用法示例。
在下文中一共展示了CachingDateFormat.getDateOnlyFormat方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deserialiseDate
import org.alfresco.util.CachingDateFormat; //導入方法依賴的package包/類
/**
* Convert XML date (of the form yyyy-MM-dd) to Date
*
* @param date the xml representation of the date
* @return the date
* @throws ParseException
*/
public static Date deserialiseDate(String date)
throws ParseException
{
Date xmlDate = null;
if (date != null)
{
SimpleDateFormat df = CachingDateFormat.getDateOnlyFormat();
xmlDate = df.parse(date);
}
return xmlDate;
}
示例2: serialiseDate
import org.alfresco.util.CachingDateFormat; //導入方法依賴的package包/類
/**
* Convert date to XML date (of the form yyyy-MM-dd)
*
* @param date the date
* @return the xml representation of the date
*/
public static String serialiseDate(Date date)
{
String xmlDate = null;
if (date != null)
{
SimpleDateFormat df = CachingDateFormat.getDateOnlyFormat();
xmlDate = df.format(date);
}
return xmlDate;
}
示例3: next
import org.alfresco.util.CachingDateFormat; //導入方法依賴的package包/類
public Token next() throws IOException
{
SimpleDateFormat dof = CachingDateFormat.getDateOnlyFormat();
Token candidate;
while ((candidate = baseTokeniser.next()) != null)
{
Date date;
if (candidate.termText().equalsIgnoreCase("now"))
{
date = new Date();
}
else if (candidate.termText().equalsIgnoreCase("today"))
{
date = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, cal.getMinimum(Calendar.HOUR_OF_DAY));
cal.set(Calendar.MINUTE, cal.getMinimum(Calendar.MINUTE));
cal.set(Calendar.SECOND, cal.getMinimum(Calendar.SECOND));
cal.set(Calendar.MILLISECOND, cal.getMinimum(Calendar.MILLISECOND));
}
else
{
try
{
date = CachingDateFormat.lenientParse(candidate.termText(), Calendar.DAY_OF_MONTH).getFirst();
}
catch (ParseException e)
{
continue;
}
}
String valueString = dof.format(date);
Token integerToken = new Token(valueString, candidate.startOffset(), candidate.startOffset(), candidate.type());
return integerToken;
}
return null;
}