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, Locale locale, TimeZone timeZone) 

Source Link

Usage

From source file:com.liferay.calendarimporter.source.LotusNotesImportSource.java

License:Open Source License

protected long getTime(JSONObject eventJSON, String key) throws ParseException {

    DateFormat dateFormatDateTime = DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US,
            _utcTimeZone);//from w ww  .ja va  2  s  .  c  o m

    JSONObject jsonObject = eventJSON.getJSONObject(key);

    String dateString = jsonObject.getString("date");
    String timeString = jsonObject.getString("time");

    Date date = (Date) dateFormatDateTime.parseObject(dateString + StringPool.SPACE + timeString);

    return date.getTime();
}