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

Free Support Forum - aspose.com

Strange time zones behavior when adding event to PST (Java)

Please see attached file with event data (ical) and code bellow that adds it to the PST:

MapiConversionOptions options = new MapiConversionOptions(OutlookMessageFormat.Unicode);
		PersonalStorage pst = PersonalStorage.create("/tmp/calendar.pst", FileFormatVersion.Unicode);
		FolderInfo tmpFolder = pst.createPredefinedFolder("Calendar", StandardIpmFolder.Appointments);	
		Appointment appt = Appointment.load("ddd.ical");
		final MailMessage msg = new MailMessage();
		final MapiMessage mapi = MapiMessage.fromMailMessage(msg, options);
		final MapiCalendar tmpCal = (MapiCalendar) mapi.toMapiMessageItem();
		String id = tmpFolder.addMapiMessageItem(tmpCal);

Event should be between 5AM and 6AM (Eastern Standard Time) , received from Office 365 but PST that opened in outlook shows it:
image.png (19.2 KB)

Attached event:
ddd.ical.zip (1.4 KB)



I have observed the image and file shared by you. Can you please confirm that when you add the ICAL data to PST the timezone of data changes in PST? In your Calendar file, I can see Eastern Time Zone. Can you please elaborate the difference you are getting when adding this to PST.

image.png (19.6 KB)

Sorry, I did not get your question.
The time zone of the computer where outlook is open is Eastern time zone. The event is eastern time tone.


I have tried using following sample code on my end and have opened the in MS Outlook 2019 on my end. It opens fine on my end without any issue.

String fileName = "ddd.ical";

PersonalStorage pst = PersonalStorage.create("ddd.pst", FileFormatVersion.Unicode);
FolderInfo calFolder = pst.createPredefinedFolder("Calendar", StandardIpmFolder.Appointments);
Appointment app = Appointment.load(fileName);
MailMessage calMsg = new MailMessage();
MapiMessage calMapiMsg = MapiMessage.fromMailMessage(calMsg);
MapiCalendar mapiCal = (MapiCalendar)calMapiMsg.toMapiMessageItem();

ddd.zip (14.4 KB)

DateTime.png (72.3 KB)

That’s very strange as I see different behaviour.
What is timezone of your application ? Can you please set it to UTC ?
TimeZone tzone = TimeZone.getTimeZone(“UTC”);
And check ?



My timezone is GTM+5. The Ical (ddd.ical) uses dates with timezone -5:

DTSTART;TZID=Eastern Standard Time:20200107T050000
DTEND;TZID=Eastern Standard Time:20200107T060000

If we open the calendar occurrence(double click on calendar item), we will see original time and timezone(-5).

Well, I upgraded version of Aspose library and seems that it’s solved the issue.


Yes, we also tested using Aspose.Email for Java 20.2. It’s good to know things are resolved on your end.