Search code examples
c#xamarincross-platformtimepicker

TimePicker on PCL Xamarin project getHour, getMinutes


I am trying to get hour and minutes from a timepicker on Xamarin pcl project. I want to convert them to integers. Is there a getHour or getMinutes method that i can use? I cannot find it. I need this to work on the Portable project NOT on android.


Solution

  • TimePicker returns a Timespan, which has Hours and Minutes properties

    var time = myTimeSpan.Time;
    int hour = time.Hours;
    int min = time.Minutes;