Time range on date picker for specific dates iPhone


I want to have a time range on a UIDatePicker, so I can display what times users can book a meeting. Say on May 25th, they can book between 12pm and 8 pm, if they scroll to May 26th they can book between 4pm and 8pm.

So I'm wondering how I can display this in a UIDatePicker? Users can't choose time outside of a preset I have for each day.

Any help is appreciated!


I found this one, hope this will help you out..

<a href="https://stackoverflow.com/questions/2441282/can-uidatepickers-minimumdate-and-maximumdate-include-time" rel="nofollow">Can UIDatePicker's minimumDate and maximumDate include time?</a>

Enjoy Coding :)


Sorry, but no. UIDatePicker can only set ranges for dates. If you want to restrict the range of the hours, you will have to subclass uidatepicker and create your own custom class. Here's a link: <a href="https://stackoverflow.com/questions/2377167/uidatepicker-hours-interval-nscalendarunit" rel="nofollow">UIDatePicker hours interval (NSCalendarUnit?)</a> Hope this helped!


I would suggest using UIPickerView to make your own date picker. Every time a date is selected, you can change what times are available inside pickerView:didSelectRow:inComponent:.


What I ended up doing was to add a target to the date picker, and check if the time of the date chosen matched the hours I preset and display an alert view if they didn't match.


  • Disable single date in p-calendar
  • UIDatePicker min/max date
  • How to set a maximum date for date picker swift 4?
  • Restrict multiple dates in date picker
  • Date model binding in ASP.NET Core
  • Drop oldest partition automatically in oracle 11G
  • Convert base64 decoded string to unsigned char[32]
  • Is is possible to integrate Joomla and Codeigniter? [closed]
  • How could I animate one stack panel item at a time?
  • R ggvis interactive slider for calculating y values (e.g. for background correction)
  • Git: failed to read object … Invalid argument
  • Get Quarters StartDate and EndDate from Year
  • MS SQL Server 2008 :Getting start date and end date of the week to next 8 weeks
  • Handle Authentication and Authorization in jax-rs webservice with cxf
  • Compiling Element Causes Input Caret Position to Move to End
  • Additional scripts in PATH
  • Aggregating two data frame columns without any existing pattern logic
  • MySql - get days remaining
  • data.table replicate rows after join?
  • Returning this from a constructor function in JS
  • R h2o.glm - issue with max_active_predictors
  • PHP multiple file uploads
  • in batch how do i use taskkill properly
  • What is the use of a session store?
  • How to get the date of next specified day of week
  • Using $compile in a directive triggers AngularJS infinite digest error
  • Android cannot disable cut copy paste
  • Clear activity stack before launching another activity
  • Calculate time difference in hh:mm:ss with simple javascript/jquery
  • Custom Tabgroup Appcelerator
  • Refering to the class itself from within a class mehod in Objective C
  • formatting the colorbar ticklabels with SymLogNorm normalization in matplotlib
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Projection media query: browser support and workarounds?
  • Illegal mix of collations for operation for date/time comparison
  • Different response to non-authenticated users and AJAX calls
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Buffer size for converting unsigned long to string
  • Hits per day in Google Big Query
  • How to get Windows thread pool to call class member function?