We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set Start and End Time Zone to MapiCalendar Object (Java)

Hi,
I have to create calendar from MapiCalendar Object. So i have to set Start time zone and End Time Zone. Please provide me some sample code.

@kharade.a,

Please give a try to the following sample code and share the feedback.

MapiCalendar cal = new MapiCalendar();

MapiCalendarTimeZoneRule daylightTransitionTime = new MapiCalendarTimeZoneRule();
daylightTransitionTime.setHour(2);
daylightTransitionTime.setMilliseconds(0);
daylightTransitionTime.setMinute(0);
daylightTransitionTime.setMonth(3);
daylightTransitionTime.setSeconds(0);
daylightTransitionTime.setYear(0);
daylightTransitionTime.setDayOfWeek(DayOfWeek.Sunday);
daylightTransitionTime.setPosition(DayPosition.Last);

MapiCalendarTimeZoneRule standardTransitionTime = new MapiCalendarTimeZoneRule();
standardTransitionTime.setHour(3);
standardTransitionTime.setMilliseconds(0);
standardTransitionTime.setMinute(0);
standardTransitionTime.setMonth(10);
standardTransitionTime.setSeconds(0);
standardTransitionTime.setYear(0);
standardTransitionTime.setDayOfWeek(DayOfWeek.Sunday);
standardTransitionTime.setPosition(DayPosition.Last);

MapiCalendarTimeZoneInfo mapiCalendarTimeZoneInfo = new MapiCalendarTimeZoneInfo();
mapiCalendarTimeZoneInfo.setBias(-60);
mapiCalendarTimeZoneInfo.setStandardBias(0);
mapiCalendarTimeZoneInfo.setDaylightBias(-60);
mapiCalendarTimeZoneInfo.setDaylightDate(daylightTransitionTime);
mapiCalendarTimeZoneInfo.setStandardDate(standardTransitionTime);
mapiCalendarTimeZoneInfo.setYear(2018);

MapiCalendarTimeZone mapiCalendarTimeZone = new MapiCalendarTimeZone();
mapiCalendarTimeZone.setKeyName("Romance Standard Time");

MapiCalendarTimeZoneInfoCollection coll = new MapiCalendarTimeZoneInfoCollection();
coll.addItem(mapiCalendarTimeZoneInfo);
mapiCalendarTimeZone.setTimeZoneRules(coll);

cal.setStartDateTimeZone(mapiCalendarTimeZone);
cal.setEndDateTimeZone(mapiCalendarTimeZone);

hi team,
I want to get calendar startdate time zone as a string in java , please provide me some sample code

@pradeepnegi,

I have tried understanding your requirements and have not been able to completely understand that. Can you please elaborate your requirement in the for of sample message and snapshot so that we may help you further.

I extracting calendar from pst file and I want to get TimeZone of appointment in UST format. how do i get it ?

@pradeepnegi,

I suggest you to please try using code example given over following thread link and add additional code sample line given below to extract time zone information.

             cal.getStartDateTimeZone().getKeyName();