org.apertereports.common.utils
Class TimeUtils

java.lang.Object
  extended by org.apertereports.common.utils.TimeUtils
All Implemented Interfaces:
ReportConstants

public class TimeUtils
extends Object
implements ReportConstants

An utility for converting dates and time.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apertereports.common.ReportConstants
ReportConstants.BooleanValues, ReportConstants.ErrorCodes, ReportConstants.InputTypes, ReportConstants.Keys, ReportConstants.Parameter, ReportConstants.ReportMimeType, ReportConstants.ReportType
 
Field Summary
 
Fields inherited from interface org.apertereports.common.ReportConstants
CACHE_MANAGER_CHECK_INTERVAL, CYCLIC_REPORT_ORDER_RESPONSE_Q, DATETIME_FORMAT, DATETIME_PATTERN, FIELD_DELIMITER, FILE_DATE_FORMAT, FILE_PREFIX, GENERATE_REPORT_Q, RECORD_DELIMITER, REPORT_ORDER_ID, SUBREPORT_MAP_PARAMETER_NAME, WS_NAMESPACE, WS_REQUEST_LOCAL_PART
 
Constructor Summary
TimeUtils()
           
 
Method Summary
static String getDateFormatted(Date date)
          Converts a given date to string using a default date format.
static Date getDateFormatted(String date)
          Method that formats a date from string using a default date format.
static String getDefaultDateFormat()
          Returns a default date format.
static long secondsToMilliseconds(int seconds)
          Converts seconds to milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeUtils

public TimeUtils()
Method Detail

getDefaultDateFormat

public static String getDefaultDateFormat()
Returns a default date format.

Returns:
Datetime format

getDateFormatted

public static Date getDateFormatted(String date)
                             throws ParseException
Method that formats a date from string using a default date format.

Parameters:
date - Input date string
Returns:
A date object
Throws:
ParseException - On date parser error

getDateFormatted

public static String getDateFormatted(Date date)
Converts a given date to string using a default date format.

Parameters:
date - Input date
Returns:
Formatted string

secondsToMilliseconds

public static long secondsToMilliseconds(int seconds)
Converts seconds to milliseconds.

Parameters:
seconds - Seconds
Returns:
Milliseconds


Copyright © 2011-2012. All Rights Reserved.