TPTP 4.2.0 Platform Project
Public API Specification

org.eclipse.hyades.logging.core
Class LoggingCoreUtilities

java.lang.Object
  extended byorg.eclipse.hyades.logging.core.LoggingCoreUtilities

public class LoggingCoreUtilities
extends java.lang.Object

Logging Core (org.eclipse.hyades.logging.core) utilities.

Since:
April 7, 2006

Constructor Summary
LoggingCoreUtilities()
           
 
Method Summary
static java.lang.String convertMillisecondsToXsdDateTime(long milliseconds)
          Converts along time stamp to an XML Schema (XSD) dateTime time stamp.
static long convertXsdDateTimeToMilliseconds(java.lang.String xsdDateTime)
          Converts an XML Schema (XSD) dateTime time stamp to a long time stamp.
static java.lang.String getFormattedDateString(long milliseconds)
          Converts a long representing a Coordinated Universal Time (UTC) date in milliseconds to a formatted string using the default date format pattern.
static java.lang.String getFormattedDateString(long milliseconds, java.lang.String dateFormatPattern)
          Converts a long representing a Coordinated Universal Time (UTC) date in milliseconds to a formatted string using the parameter date format pattern.
static java.lang.String getFormattedDateString(java.lang.String xsdDateTime)
          Converts a string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date to a formatted string using the default date format pattern.
static java.lang.String getFormattedDateString(java.lang.String xsdDateTime, java.lang.String dateFormatPattern)
          Converts a string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date to a formatted string using the parameter date format pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingCoreUtilities

public LoggingCoreUtilities()
Method Detail

convertXsdDateTimeToMilliseconds

public static long convertXsdDateTimeToMilliseconds(java.lang.String xsdDateTime)
Converts an XML Schema (XSD) dateTime time stamp to a long time stamp.

The XSD dateTime time stamp represents a finite-length sequence of characters following the following format pattern:

yyyy-MM-dd'T'HH:mm:ss[.SSSS]['Z'|Z]

For more information on the meaning of the individual symbols in the XSD dateTime time stamp format pattern, see the class comment header for SimpleDateFormat.

For example, March 14, 2006 11:32:01.001 AM UTC/GMT would be represented as:

2006-03-14T11:32:01.001Z

See the XSD dateTime primitive datatype documentation for more information.

The long time stamp represents the difference, measured in milliseconds, between the current time (Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT)) and the standard base time. The standard base time is known as "the epoch", namely January 1, 1970 12:00:00 AM Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT).

Note: Due to inconsistencies between XSD V1.0 and later versions of the XSD specification on representing zero or negative XSD dateTime time stamps, such as year 0 and year 1 Before Common Era (BCE or BC), this method will throw an IllegalArgumentException for parameter XSD dateTime time stamps before 0001-01-01T00:00:00.000Z or -62135769600000. See the XSD dateTime note for more information.

Parameters:
xsdDateTime - The XSD dateTime time stamp to be converted to a long (milliseconds) time stamp.
Returns:
The long (milliseconds) time stamp representation of the parameter XSD dateTime time stamp.
Throws:
java.lang.IllegalArgumentException - If the parameter XSD dateTime time stamp is not a valid XSD dateTime time stamp.

convertMillisecondsToXsdDateTime

public static java.lang.String convertMillisecondsToXsdDateTime(long milliseconds)
Converts along time stamp to an XML Schema (XSD) dateTime time stamp.

The long time stamp represents the difference, measured in milliseconds, between the current time (Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT)) and the standard base time. The standard base time is known as "the epoch", namely January 1, 1970 12:00:00 AM Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT).

The XSD dateTime time stamp represents a finite-length sequence of characters following the following format pattern:

yyyy-MM-dd'T'HH:mm:ss[.SSSS]['Z'|Z]

For more information on the meaning of the individual symbols in the XSD dateTime time stamp format pattern, see the class comment header for SimpleDateFormat.

For example, March 14, 2006 11:32:01.001 AM UTC/GMT would be represented as:

2006-03-14T11:32:01.001Z

See the XSD dateTime primitive datatype documentation for more information.

Note: Due to inconsistencies between XSD V1.0 and later versions of the XSD specification on representing zero or negative XSD dateTime time stamps, such as year 0 and year 1 Before Common Era (BCE or BC), this method will return a positive XSD dateTime time stamp for parameter long (milliseconds) time stamps before -62135769600000 or 0001-01-01T00:00:00.000Z. See the XSD dateTime note for more information.

Parameters:
milliseconds - The long (milliseconds) time stamp to be converted to an XSD dateTime time stamp.
Returns:
The XSD dateTime time stamp representation of the parameter long (milliseconds) time stamp .

getFormattedDateString

public static java.lang.String getFormattedDateString(long milliseconds)
                                               throws java.lang.IllegalArgumentException
Converts a long representing a Coordinated Universal Time (UTC) date in milliseconds to a formatted string using the default date format pattern.

The default date format is:

MMMM d, yyyy h:mm:ss.SSS a z

For more information on the meaning of the individual symbols in the default date format pattern, see the class comment header for java.util.SimpleDateFormat.

The time zone of the returned string is Coordinated Universal Time (UTC), represented as Greenwich Mean Time (GMT).

Parameters:
milliseconds - A long representing a Coordinated Universal Time (UTC) time stamp in milliseconds.
Returns:
The date as a formatted string using the default date format pattern (e.g. MMMM d, yyyy h:mm:ss.SSS a z).
Throws:
java.lang.IllegalArgumentException - If the long representing a Coordinated Universal Time (UTC) time stamp in milliseconds is negative.
See Also:
java.util.SimpleDateFormat

getFormattedDateString

public static java.lang.String getFormattedDateString(long milliseconds,
                                                      java.lang.String dateFormatPattern)
                                               throws java.lang.IllegalArgumentException
Converts a long representing a Coordinated Universal Time (UTC) date in milliseconds to a formatted string using the parameter date format pattern.

When the International Components for Unicode (ICU) JAR(s) are available on the class path at run-time, date formatting is done by the SimpleDateFormat class using the ULocale (parameter Locale converted to a ULocale - see ULocale.forLocale(Locale)), GregorianCalendar and TimeZone (parameter time zone ID converted to a TimeZone - see TimeZone.getTimeZone(String)) classes, otherwise date formatting is done by the SimpleDateFormat class using the Locale, GregorianCalendar and TimeZone classes. That is, if the International Components for Unicode (ICU) JAR(s) are available on the class path at run-time, the parameter date format pattern is based on the syntax and symbols as specified in the class comment header of the SimpleDateFormat class, otherwise the parameter date format pattern is based on the syntax and symbols as specified in the class comment header of the java.util.SimpleDateFormat class.

The time zone of the returned string is Coordinated Universal Time (UTC), represented as Greenwich Mean Time (GMT).

Parameters:
milliseconds - A long representing a Coordinated Universal Time (UTC) time stamp in milliseconds.
dateFormatPattern - The date format pattern.
Returns:
The date as a formatted string using the parameter date format pattern.
Throws:
java.lang.IllegalArgumentException - If the date format pattern invalid.
See Also:
SimpleDateFormat, Locale, GregorianCalendar, TimeZone, SimpleDateFormat, ULocale, GregorianCalendar, TimeZone

getFormattedDateString

public static java.lang.String getFormattedDateString(java.lang.String xsdDateTime)
                                               throws java.lang.IllegalArgumentException
Converts a string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date to a formatted string using the default date format pattern.

For more information on the XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date, see http://www.w3.org/TR/NOTE-datetime.

The default date format is:

MMMM d, yyyy h:mm:ss.SSS a z

For more information on the meaning of the individual symbols in the default date format pattern, see the class comment header for java.util.SimpleDateFormat.

If the parameter string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date does not contain any time zone information, the time zone of the returned string is Coordinated Universal Time (UTC), represented as Greenwich Mean Time (GMT). Otherwise, the time zone of the returned string is represented as a signed offset from Greenwich Mean Time (GMT). For example, 'GMT-05:00' for Eastern Standard Time.

Parameters:
xsdDateTime - A string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date.
Returns:
The date as a formatted string using the default date format pattern (e.g. MMMM d, yyyy h:mm:ss.SSS a z).
Throws:
java.lang.IllegalArgumentException - If the string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date is invalid.
See Also:
java.util.SimpleDateFormat

getFormattedDateString

public static java.lang.String getFormattedDateString(java.lang.String xsdDateTime,
                                                      java.lang.String dateFormatPattern)
                                               throws java.lang.IllegalArgumentException
Converts a string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date to a formatted string using the parameter date format pattern.

For more information on the XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date, see http://www.w3.org/TR/NOTE-datetime.

When the International Components for Unicode (ICU) JAR(s) are available on the class path at run-time, date formatting is done by the SimpleDateFormat class using the ULocale (parameter Locale converted to a ULocale - see ULocale.forLocale(Locale)), GregorianCalendar and TimeZone (parameter time zone ID converted to a TimeZone - see TimeZone.getTimeZone(String)) classes, otherwise date formatting is done by the SimpleDateFormat class using the Locale, GregorianCalendar and TimeZone classes. That is, if the International Components for Unicode (ICU) JAR(s) are available on the class path at run-time, the parameter date format pattern is based on the syntax and symbols as specified in the class comment header of the SimpleDateFormat class, otherwise the parameter date format pattern is based on the syntax and symbols as specified in the class comment header of the java.util.SimpleDateFormat class.

If the parameter string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date does not contain any time zone information, the time zone of the returned string is Coordinated Universal Time (UTC), represented as Greenwich Mean Time (GMT). Otherwise, the time zone of the returned string is represented as a signed offset from Greenwich Mean Time (GMT). For example, 'GMT-05:00' for Eastern Standard Time.

Parameters:
xsdDateTime - A string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date.
dateFormatPattern - The date format pattern.
Returns:
The date as a formatted string using the parameter date format pattern.
Throws:
java.lang.IllegalArgumentException - If the string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date is invalid or the date format pattern is invalid.
See Also:
SimpleDateFormat, Locale, GregorianCalendar, TimeZone, SimpleDateFormat, ULocale, GregorianCalendar, TimeZone

TPTP 4.2.0 Platform Project
Public API Specification