Share via


AlarmManager.SetTimeZone(String) Method

Definition

Sets the system's persistent default time zone.

[Android.Runtime.Register("setTimeZone", "(Ljava/lang/String;)V", "GetSetTimeZone_Ljava_lang_String_Handler")]
[Android.Runtime.RequiresPermission("android.permission.SET_TIME_ZONE")]
public virtual void SetTimeZone (string? timeZone);
[<Android.Runtime.Register("setTimeZone", "(Ljava/lang/String;)V", "GetSetTimeZone_Ljava_lang_String_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.SET_TIME_ZONE")>]
abstract member SetTimeZone : string -> unit
override this.SetTimeZone : string -> unit

Parameters

timeZone
String

one of the Olson ids from the list returned by java.util.TimeZone#getAvailableIDs

Attributes

Remarks

Sets the system's persistent default time zone. This is the time zone for all apps, even after a reboot. Use java.util.TimeZone#setDefault if you just want to change the time zone within your app, and even then prefer to pass an explicit java.util.TimeZone to APIs that require it rather than changing the time zone for all threads.

On android M and above, it is an error to pass in a non-Olson timezone to this function. Note that this is a bad idea on all Android releases because POSIX and the TimeZone class have opposite interpretations of '+' and '-' in the same non-Olson ID.

Java documentation for android.app.AlarmManager.setTimeZone(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to