Class TimeZoneSetting
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringThe time zone used if the user does not set a time zone preference.static final StringThe internal preference key to store the time zone preference.Fields inherited from class oracle.webcenter.generalsettings.internal.model.GSPreferences
NULL_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CalendarGet the current time as a Calendar object based on the current user's timezone setting.static CalendargetCurrentTime(String username) Gets the current time as a Calendar object based on the given user's timezone setting.static StringReturns the application's default time zone identifier.static CalendarReturns a Calendar object representing the current time at the Greenwich Meridian (time zone GMT+00:00).static intReturns the number of minutes since midnight based on the current user's timezone setting.static intgetMidnightOffset(String username) Returns the number of minutes since midnight based on the given user's timezone setting.static CalendarGets the Calendar object representing the midnight hour for the current date irrespective of the current time.static CalendargetMidnightToday(String username) Gets the Calendar object representing the midnight hour for the current date irrespective of the current time.static intReturns the number of minutes since midnight of the previous night based on the current user's timezone setting.static intgetMidnightYesterdayOffset(String username) Returns the number of minutes since midnight of the previous night based on the given user's timezone setting.static StringReturns the current user's preferred time zone identifier.static StringgetPreferredTimeZone(String username) Returns the given user's preferred time zone identifier.static TimeZoneGets the current user's preferred time zone (as a TimeZone object).static TimeZonegetUserTimeZone(String username) Gets the given user's preferred time zone (as a TimeZone object).static StringReturns the current user's time zone identifier preference value.static StringgetUserTimeZonePref(String username) Returns the given user's time zone identifier preference value.static voidsetDefaultTimeZone(String timezone) Sets the application's time zone identifier.static voidsetPreferredTimeZone(String timezone) Deprecated.replaced by setUserTimeZonePref()static voidsetPreferredTimeZone(String username, String timezone) Deprecated.replaced by setUserTimeZonePref()static voidsetUserTimeZone(String username, TimeZone timezone) Sets the given user's preferred time zone (as a TimeZone object).static voidsetUserTimeZone(TimeZone timezone) Sets the current user's preferred time zone (as a TimeZone object).static voidsetUserTimeZonePref(String timezone) Set the current user's preferred time zone identifier.static voidsetUserTimeZonePref(String username, String timezone) Sets the given user's preferred time zone identifier.Methods inherited from class oracle.webcenter.generalsettings.internal.model.GSPreferences
getPreferred, getPreferred, getProvider, getSystemPref, getUserPref, getUserPref, log, setSystemPref, setUserPref
-
Field Details
-
TIME_ZONE_KEY
The internal preference key to store the time zone preference.- See Also:
-
DEFAULT_TIMEZONE_ID
The time zone used if the user does not set a time zone preference. This default time zone is based on the server's time zone.
-
-
Constructor Details
-
TimeZoneSetting
public TimeZoneSetting()
-
-
Method Details
-
getPreferredTimeZone
Returns the current user's preferred time zone identifier.The time zone identifier returned is in the format GMT{+|-}hh:mi, for example, GMT+05:30 or GMT-08:00. This identifier enables you to create a
java.util.TimeZoneobject as follows :-
TimeZone.getTimeZone("GMT+05:30");- Returns:
- the current user's preferred time zone identifier
-
getPreferredTimeZone
Returns the given user's preferred time zone identifier.The time zone identifier is returned in the format GMT{+|-}hh:mi, for example, GMT+05:30 or GMT-08:00. This identifier can be used to create a
java.util.TimeZoneobject as follows :-
TimeZone.getTimeZone("GMT+05:30");- Parameters:
username- the username to obtain the preference for. If null, obtains the preference for the current authenticated user- Returns:
- the given user's preferred time zone identifier
-
getUserTimeZonePref
Returns the current user's time zone identifier preference value. If the user's preference is not set, returns null. This API is designed to be used in a user preference setting UI, for all other uses, thegetPreferredTimeZone()API should be used.The time zone identifier is returned in the format GMT{+|-}hh:mi, for example, GMT+05:30 or GMT-08:00.
- Returns:
- the current user's time zone identifier preference value or null if the user preference is not set.
-
getUserTimeZonePref
Returns the given user's time zone identifier preference value. If the user's preference is not set, returns null. This API is designed to be used in a user preference setting UI, for all other uses, thegetPreferredTimeZone()API should be used.The time zone identifier is returned in the format GMT{+|-}hh:mi, for example, GMT+05:30 or GMT-08:00.
- Parameters:
username- the username to obtain the preference for. If null, obtains the preference for the current authenticated user- Returns:
- the current user's time zone identifier preference value or null if the user preference is not set.
-
setPreferredTimeZone
Deprecated.replaced by setUserTimeZonePref() -
setPreferredTimeZone
Deprecated.replaced by setUserTimeZonePref() -
setUserTimeZonePref
Set the current user's preferred time zone identifier.The time zone identifier should be of the format GMT{+|-}hh:mi e.g. GMT+05:30 or GMT-08:00.
- Parameters:
timezone- the preferred time zone identifier
-
setUserTimeZonePref
Sets the given user's preferred time zone identifier.The time zone identifier should be in the format GMT{+|-}hh:mi, for example, GMT+05:30 or GMT-08:00.
- Parameters:
username- the username to set the preference for. If null, sets the preference for the current authenticated usertimezone- the preferred time zone identifier
-
getDefaultTimeZone
Returns the application's default time zone identifier.The time zone identifier returned is in the format GMT{+|-}hh:mi, for example, GMT+05:30 or GMT-08:00. This identifier enables you to create a
java.util.TimeZoneobject as follows :-
TimeZone.getTimeZone("GMT+05:30");- Returns:
- the application's default time zone identifier
-
setDefaultTimeZone
Sets the application's time zone identifier.The time zone identifier should be in the format GMT{+|-}hh:mi, for example, GMT+05:30 or GMT-08:00.
- Parameters:
timezone- the preferred time zone identifier
-
getUserTimeZone
Gets the current user's preferred time zone (as a TimeZone object).- Returns:
- the current user's preferred time zone
-
getUserTimeZone
Gets the given user's preferred time zone (as a TimeZone object).- Parameters:
username- the username to obtain the preference for. If null, obtains the preference for the current authenticated user- Returns:
- the given user's preferred time zone
-
setUserTimeZone
Sets the current user's preferred time zone (as a TimeZone object).- Parameters:
timezone- the time zone to set
-
setUserTimeZone
Sets the given user's preferred time zone (as a TimeZone object).- Parameters:
username- the username to set the preference for. If null, sets the preference for the current authenticated usertimezone- the time zone to set
-
getCurrentTime
Get the current time as a Calendar object based on the current user's timezone setting.- Returns:
- the current time for the current user
-
getCurrentTime
Gets the current time as a Calendar object based on the given user's timezone setting.- Parameters:
username- the username to obtain the preference for. If null, obtains the preference for the current authenticated user- Returns:
- the current time for the given user
-
getMidnightToday
Gets the Calendar object representing the midnight hour for the current date irrespective of the current time. For example if the current time based on the current user's timezone is 14:00 on 31st May 2007, this method will return '00:00 31th May 2007'. -
getMidnightToday
Gets the Calendar object representing the midnight hour for the current date irrespective of the current time. For example if the current time based on the current user's timezone is 14:00 on 24th April 2009, this method will return '00:00 24th April 2009'. -
getMidnightOffset
@Exported public static int getMidnightOffset()Returns the number of minutes since midnight based on the current user's timezone setting. For example, at 04:00, this method returns 240 (4 hours x 60).- Returns:
- number of minutes since midnight
-
getMidnightOffset
Returns the number of minutes since midnight based on the given user's timezone setting. For example, at 04:00, this method returns 240 (4 hours x 60).- Parameters:
username- the username to obtain the preference for. If null, obtains the preference for the current authenticated user- Returns:
- number of minutes since midnight
-
getMidnightYesterdayOffset
@Exported public static int getMidnightYesterdayOffset()Returns the number of minutes since midnight of the previous night based on the current user's timezone setting. For example, at 04:00, this method returns 1680 (4 hours x 60 + 24 hours x 60).- Returns:
- number of minutes since midnight yesterday
-
getMidnightYesterdayOffset
Returns the number of minutes since midnight of the previous night based on the given user's timezone setting. For example, at 04:00, this method returns 1680 (4 hours x 60 + 24 hours x 60).- Parameters:
username- the username to obtain the preference for. If null, obtains the preference for the current authenticated user- Returns:
- number of minutes since midnight yesterday
-
getGMTTime
Returns a Calendar object representing the current time at the Greenwich Meridian (time zone GMT+00:00).- Returns:
- a Calendar object representing the current time in timezone GMT+00:00
-