2

I am running the following code to view a specific event that I select out of a ListActivity:

Uri viewUri = Uri.parse("content://com.android.calendar/events/"+events.get(position).id);
Intent l_intent = new Intent(Intent.ACTION_VIEW);
l_intent.setData(viewUri);
startIntent(l_intent);

I am aware that the above code is not directly supported by Android - I am running this on Android 2.2. However, no matter what event I click on, the date/time is shown as December 31, 1969 at 7:00 p.m. When I look at my actual calendar, the event is in its rightful place. Also, if I run the following line:

System.out.println("start time is"+getDateTimeStr(events.get(position).startTime));

(where getDateTimeStr formats the string), I get the correct date/time back.

Does anyone know what could be causing this?

John Roberts
  • 5,885
  • 21
  • 70
  • 124

1 Answers1

0

December 31, 1969 at 7:00 p.m is the start value in EST timezone of Date object initialized with no time i.e. January 01, 1970 at 0:00 a.m in UTC timezone.

This way I am sure that your date is just getting initialized without any time. Please review your code and set the time appropriately.

Yogendra Singh
  • 33,927
  • 6
  • 63
  • 73
  • I agree with you, but I just don't see how it could be getting initialized without any time. Check out the edit I just made to the question. – John Roberts Nov 22 '12 at 23:09