Example usage for com.liferay.portal.kernel.util DateFormatFactoryUtil getSimpleDateFormat

List of usage examples for com.liferay.portal.kernel.util DateFormatFactoryUtil getSimpleDateFormat

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util DateFormatFactoryUtil getSimpleDateFormat.

Prototype

public static DateFormat getSimpleDateFormat(String pattern, TimeZone timeZone) 

Source Link

Usage

From source file:com.liferay.dynamic.data.mapping.service.test.BaseDDMServiceTestCase.java

License:Open Source License

protected Serializable getDateFieldValue(int month, int day, int year, Locale locale) {

    Date dateValue = PortalUtil.getDate(month, day, year);

    DateFormat dateFormat = DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd", locale);

    return dateFormat.format(dateValue);
}

From source file:com.liferay.portlet.amazonrankings.util.AmazonRankingsWebCacheItem.java

License:Open Source License

protected Date getReleaseDate(String releaseDateAsString) {
    if (Validator.isNull(releaseDateAsString)) {
        return null;
    }//from  www  .j ava 2  s.c o m

    DateFormat dateFormat = null;

    if (releaseDateAsString.length() > 7) {
        dateFormat = DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd", Locale.US);
    } else {
        dateFormat = DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM", Locale.US);
    }

    return GetterUtil.getDate(releaseDateAsString, dateFormat);
}