1

I tried to set the initial Date at UIDatePicker in Monotouch. The DatePicker always shows 1:05 in UIDatePickerMode.Time. If I do nothing it shows the current Time correctly.

Anybody can help me how to do this in Monotouch?

Richard Liebmann
  • 416
  • 1
  • 6
  • 19

1 Answers1

4

Are you setting up your NSDate corre correctly? This answer shows two ways to create a NSDate.

pick = new UIDatePicker (new RectangleF (0, 20, this.View.Bounds.Width, 10));   

// Set NSDate:
DateTime date = DateTime.Parse("1981-07-01 22:21:00");
NSDate nsDate = DateTime.SpecifyKind(date, DateTimeKind.Utc);

// Get DateTime from NSDate:
date = DateTime.SpecifyKind(nsDate, DateTimeKind.Unspecified);
pick.Date = date;
pick.Mode = UIDatePickerMode.Time;
Community
  • 1
  • 1
holmes
  • 1,341
  • 9
  • 9
  • Thank's for answer but i can't get it work.... So i overwrite it in a Methode and add a hour and 5 minutes. – Richard Liebmann May 19 '12 at 17:06
  • I do not understand. What are you trying to set this time to? Do you want to set it to 1:05? Can you update your question with a code sample of what you are trying? – holmes May 20 '12 at 13:26