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 Detail

TimeZoneSetting

public TimeZoneSetting()

Method Detail

getPreferredTimeZone

public static java.lang.String 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.TimeZone object as follows :-TimeZone.getTimeZone("GMT+05:30");

Returns:

the current user's preferred time zone identifier

getPreferredTimeZone

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.TimeZone object 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

public static java.lang.String 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, the getPreferredTimeZone() 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, the getPreferredTimeZone() 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.

setUserTimeZonePref

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 user

timezone - the preferred time zone identifier

getDefaultTimeZone

public static java.lang.String 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.TimeZone object as follows :-TimeZone.getTimeZone("GMT+05:30");

Returns:

the application's default time zone identifier

setDefaultTimeZone

public static void setDefaultTimeZone(java.lang.String timezone)

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.

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

public static java.util.Calendar 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

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

public static int getMidnightOffset(java.lang.String username)

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

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).