Issue with UIDatePicker - iphone

I want to show only day and month and not year in my date picker. Not sure how to achieve this. Please suggest.

you'll find the answer by Googling this and clicking on the first entry which happens to be from Stackoverflow also: UIDatePicker show only month and day
Hope it helps!

I solved this by setting the maximumDate property to current date. This disabled the dates from current date.

Related

How to show only the days in current month - ionic2-calendar

I'm developing a calendar app using ionic and I want to show only the current days in the month in the view. I'm using ionic2-calendar and now it shows the previous month's last days, current month's days, and next month's first days in one calendar view. Please help me with this.
Thanks to #Indraraj26 's comment, I finally managed to solve the issue by adding visibility: hidden to the related class in global.scss file . (as below)
td.text-muted{
visibility: hidden;
}
The best option I can find is to begin the month on the 1st, hiding the greyed out days before the 1st day of the month. Do this by adding the option [startingDayMonth]=1 to the calendar directive, e.g.
<calendar
...
[startingDayMonth]=1
...
></calendar>
As #Indraraj26 pointed out, you could hide td.text-muted globally but this could well have side-effects.
I would certainly create an issue to add a similar option for hiding next month's dates.

when particular date is selected in datepicker, how do i populate the particular day of week automatically?

I want to show the particular day of week when the user select a particular date from datepicker.
When the user clicks on day button i want to automatically select the day of week for that selected date??
[self.datePicker setDate:[NSDate date] animated:NO];
try this, let me know if it doesnt work. i havent tried it.
hope it works, happy coding :)

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..
Can UIDatePicker's minimumDate and maximumDate include time?
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: UIDatePicker hours interval (NSCalendarUnit?)
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.

PickerView for date and time

I have used uipickerview from interface in my application.But it is not selecting the current date and time.Please,help me.
Thanks
provide some code i think this will help...
do you have selected the property MaxDate as today ? if not then select as.

UIDatePicker hours interval (NSCalendarUnit?)

I'm trying to make a UIDatePicker which allows the selection of hours only between 6.00 and 17.00. The other hours shall be inactive but still visible.
I think it can be done with setting up the picker calendar and then use this:
- (NSRange)maximumRangeOfUnit:(NSCalendarUnit)unit
but I'm not sure how.
Maybe someone can help me.
Thank you!
Sorry, but UIDatePicker doesn't support setting valid time ranges like you describe. The only options are minimum and maximum dates.
You'll either need to build a custom control from scratch or try to subclass UIDatePicker, but that's not a path I'd recommend.