Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eventTimezone value

can anybody help me about what to insert in the eventTimezone value when adding an event to a calendar? this is my code:

    Intent intent = new Intent(Intent.ACTION_INSERT);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("title", eventName);
    intent.putExtra("beginTime", startCal.getTimeInMillis());
    intent.putExtra("endTime", endCal.getTimeInMillis());   
    intent.putExtra("eventTimezone","Hong Kong");
    startActivity(intent);

everything else works fine but the eventTimezone doesnt seem to change the option of the timezone to my desired timezone. what value do i need? ive tried "GMT+1" and "(GMT+8:00) Hong Kong" but they are not working.

like image 255
SleepNot Avatar asked Feb 19 '23 12:02

SleepNot


1 Answers

This is how you get the timezone into it

TimeZone tz = TimeZone.getDefault();
intent.putExtra(Events.EVENT_TIMEZONE, tz.getID());
like image 182
pt123 Avatar answered Feb 22 '23 00:02

pt123