---
title: "How to pick Date and Time separately in iOS?"  
description: "How to pick Date and Time separately in iOS?"  
author: "Anonymous User"  
published: 2016-03-28  
updated: 2016-03-29  
canonical: https://www.mindstick.com/forum/34085/how-to-pick-date-and-time-separately-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c", "ipad"]  
reading_time: 1 minute  

---

# How to pick Date and Time separately in iOS?

I am using *NSDatePickerView* [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) in our [iPhone app](https://www.mindstick.com/articles/208914/4life-innovations-is-bracing-up-to-acquire-ios-13-for-iphone-app-development). I have a need to set the [Date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner) and Time in different position. So, I use *NSDatePickerModeDate* to pick Date and *NSDatePickerModeTime* to pick Time.

But both of them are referring to same *NSDate* object inside a *NSMutableDictionary*, and I know about the *NSDatePickerModeDateTime*, but our need is to get the Date &[amp](https://www.mindstick.com/forum/156207/what-is-amp); Time spearatedly.\
Please help me..!

## Replies

### Reply by Tarun Kumar

If you want to get separate Date and Time then we need to convert full date to only date format and convert date to only time format. below we are provided both examples:\
// *Convert to Date Format*

```
- (IBAction) convertToDate:(UIDatePickerView *)sender { NSDateFormatter *date_format = [[NSDateFormatter alloc] init]; [date_format setDateFormat:@"MM/DD/YYYY"]; NSString *date = [date_format stringFromDate:[sender date]]; [data setObject:date forKey:@"date"];}
```

// *Convert to Time format*

```
- (IBAction) convertToTime:(UIDatePickerView *)sender { NSDateFormatter *time_format = [[NSDateFormatter alloc] init]; [time_format setDateFormat:@"HH:MM a"]; NSString *time = [time_format stringFromDate:[sender date]]; [data setObject:time forKey:@"Time"];}
```

I hope above example is helpful for you.


---

Original Source: https://www.mindstick.com/forum/34085/how-to-pick-date-and-time-separately-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
