Class UnlocalizedDateTimeFormat

java.lang.Object
com.saperion.common.lang.format.UnlocalizedDateTimeFormat

public final class UnlocalizedDateTimeFormat extends Object

UnlocalizedDateTimeFormat is a utility class to convert Date objects to an unlocalized, time-zone independent, character-set-independent string format and vice versa.

This format is intended for file import/export and data transfer between systems as an independent data format.

This format is explicitly not to use for GUI-clients as they usually should attend localization, time-zone and so on.

The format is more or less like a SimpleDateFormat format of "Gyyyy-MM-dd HH:mm:ss.SSS" with an era of "-" for BC and none era for AD.

This format is optimized this single format and for speed, so it is much faster than the SimpleDateFormat.

An instance of this UnlocalizedDateTimeFormat can be used in several threads concurrently.

Author:
agz
  • Method Details

    • format

      public static String format(Date date)
      Formats the specified Date to an unlocalized string.

      The specified Date must not be null.

      Parameters:
      date - Date to format
      Returns:
      unlocalized string
      See Also:
    • parse

      public static Date parse(String unlocalizedString) throws ParseException
      Parses the specified unlocalized string to a Date.

      The specified unlocalized string must not be null.

      Parameters:
      unlocalizedString - unlocalized string to parse
      Returns:
      Date
      Throws:
      ParseException - if the specified string is invalid
      See Also: