Skip navigation links


oracle.iam.platformservice.utils
Class PlatformDateTimeUtil

java.lang.Object
  extended by oracle.iam.platformservice.utils.PlatformDateTimeUtil


public class PlatformDateTimeUtil
extends java.lang.Object

Constructor Summary
PlatformDateTimeUtil()
           

 

Method Summary
static java.lang.String formatDate(java.util.Date date)
          Method that converts a date object into string based on locale and timezone The formatted date is in the DateFormat.LONG format and includes Time
static java.lang.String formatDate(java.util.Date date, java.util.Hashtable userProfile)
          Formats the supplied date for the desired locale and time zone
static java.lang.String formatDate(java.util.Date date, int style, boolean dateOnly)
          Method that converts a date object into string based on locale and timezone
static java.lang.String formatDateToGMT(java.util.Date date)
          Method to format a given date and return the string representation in GMT.
static java.lang.String getPattern()
          Method to give the date time pattern for a given locale and DateFormat.LONG style.
static java.lang.String getPattern(int style)
          Method to give the date time pattern for a given locale and style It modifies the pattern to also include the Timezone if not already present This method will be useful for specifying the pattern for date components.
static java.util.Date parseDate(java.lang.String date)
          Method to parse a given date and return java date object that includes Time.
static java.util.Date parseDate(java.lang.String date, java.util.Hashtable userProfile)
          Parses the supplied date for the desired locale and time zone
static java.util.Date parseDate(java.lang.String date, int style, boolean dateOnly)
          Method to parse a given date and return java date object.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

PlatformDateTimeUtil

public PlatformDateTimeUtil()

Method Detail

formatDate

public static java.lang.String formatDate(java.util.Date date,
                                          int style,
                                          boolean dateOnly)
Method that converts a date object into string based on locale and timezone
Parameters:
date - Date to be formatted
style - Values expected are DateFormat.LONG, DateFormat.SHORT ..
dateOnly, - Whether formatter should just format the date or both date and time
Returns:
a formatted date

formatDate

public static java.lang.String formatDate(java.util.Date date)
Method that converts a date object into string based on locale and timezone The formatted date is in the DateFormat.LONG format and includes Time
Parameters:
date - Date to be formatted
Returns:

formatDate

public static java.lang.String formatDate(java.util.Date date,
                                          java.util.Hashtable userProfile)
Formats the supplied date for the desired locale and time zone
Parameters:
date - Date to format
userProfile - List of custom properties based on which formatting will take place Following properties can be set. Only dateFormat is optional. If it is not provided, it defaults to LONG
  • locale, java Locale object
  • dateFormat, format to be used
  • timeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00"
Returns:
a formatted string based on custom properties

parseDate

public static java.util.Date parseDate(java.lang.String date,
                                       java.util.Hashtable userProfile)
                                throws java.text.ParseException
Parses the supplied date for the desired locale and time zone
Parameters:
date - Date to parse
userProfile - List of custom properties based on which formatting will take place Following properties can be set. Only dateFormat is optional. If it is not provided, it defaults to LONG
  • locale, java Locale object
  • dateFormat, format to be used
  • timeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00"
Returns:
a Parsed Date object based on custom properties
Throws:
java.text.ParseException

parseDate

public static java.util.Date parseDate(java.lang.String date,
                                       int style,
                                       boolean dateOnly)
                                throws java.text.ParseException
Method to parse a given date and return java date object. Uses user locale and timezone to figure out the date format
Parameters:
date, - date to be parsed
style, - Expected values are DateFormat.SHORT, DateFormat.LONG..
dateOnly, - whether formatter should just parse the date or both date and time
Returns:
the parsed Date object
Throws:
java.text.ParseException

parseDate

public static java.util.Date parseDate(java.lang.String date)
                                throws java.text.ParseException
Method to parse a given date and return java date object that includes Time. Uses DateFormat.LONG as the style for formatting the date
Parameters:
date, - date to be parsed
Returns:
the parsed Date object
Throws:
java.text.ParseException

formatDateToGMT

public static java.lang.String formatDateToGMT(java.util.Date date)
                                        throws java.text.ParseException
Method to format a given date and return the string representation in GMT.
Parameters:
date, - date to be formatted
Returns:
the formatted String containing the date in GMT
Throws:
java.text.ParseException

getPattern

public static java.lang.String getPattern(int style)
Method to give the date time pattern for a given locale and style It modifies the pattern to also include the Timezone if not already present This method will be useful for specifying the pattern for date components.
Parameters:
style - The DateFormat style. Takes the int values like DateFormat.LONG, DateFormat.SHORT etc.
Returns:
The pattern based on the user's resolved locale and given style

getPattern

public static java.lang.String getPattern()
Method to give the date time pattern for a given locale and DateFormat.LONG style. It modifies the pattern to also include the Timezone if not already present This method will be useful for specifying the pattern for date components.
Returns:
The pattern based on the user's resolved locale and DateFormat.LONG style

Skip navigation links


Copyright © 2010, Oracle and/or its affiliates. All rights reserved.