UIdatepicker showing weekdays - ios

I would like to make a datepicker that shows weekdays, date and month.
I got a working datepicker showing month, date and year but I would really like it to show month, day, date
How is this possible? I know I might have to make a custom UIpicker, but how to I make this refer to dates?

You need to create your own picker with a UIPickerView. Create an NSDateFormatter. You can then access the month names and the weekday names from the date formatter. An NSCalendar can be used to obtain the maximum number of days for a month.
The real trick is updating the picker view components as the user selects a value from one of the components. For example, if the user picks a month, you want to update the number of days shown in the day component (or, like a UIDatePicker), grey out invalid days. This is complicated by the fact that you don't have a year so there is no way to properly handle February.
And what do you do when a user picks a given weekday? How should this affect the selected day? Just things to consider.

Related

Using date picker as filter in django admin

How to get date picker in Django Admin Filter?
using simple list_filter will get me text selection: Any date, last 7 days, last months etc. But I want simple datepicker, so i can choose just one date... I found django-admin-daterange but I don't need range - just ONE date..

Adjusting Tableau Date Values to per month

I'm looking to adjust the basic Tableau time frame from the ISO/Gregorian format to a customized one. Currently, I'm displaying data in a line chart by Month and week. The week format is based on 52 weeks ie 'Week 43' = 10/17-10/23. I would like to display the week time line relative to its given month ie the column would read October 'Week 1' = 10/01 - 10/07, 'Week 2' = 10/08-10/14 and the following month would reset the weeks to start at zero. Is this achieved by a parameter?
There are a few features in Tableau that will help you with this.
Read through the on-line help about creating custom dates, setting fiscal years for date fields. The custom date feature is based on the Tableau function DATE_TRUNC() so you might want to read about that as well.
The short answer though is - right click on your date field in the data pane on the left margin, then set the fiscal year start under the default properties and create a custom date at the week level. You want to create a date value, not a date part.
Then use your custom date to build your viz, and change it between discrete and continuous depending on how you want to present your values.

how to create DateAndTime picker in swift 4 which so that user is able to select date and time both

I have implemented the iOS date and time picker is my project like this
but the problem here is that is user want to select year and month then there is no option. how to solve this I can not find any library.
I want a date and time picker from which user can select date year, month,day and time hh:mm ?
You could use the UIPicker class to implement your own date an time picker. It would have year, month, day, hour, minute, and possibly AM/PM sections. You'd need to build some intelligence around changing the available days depending on the month (different months have different numbers of days, and on leap years February has a different number of days than on other years.)

Best way to store the day of the week using NSDate and NSDateFormatter

I'm trying to reproduce some of the functionality of the default Clock where I let users select a repeat frequency for an alarm. The problem is that different NSCalendar settings will give you different names for the days of the week. How do I store the selected days of the week in such a way that if the user changes their calendar the frequency always falls on the right day of the week?
One solution would be to check if the calendar has changed every time the app comes into foreground, and if so, make appropriate changes from there. Probably not the most elegant solution, nor the best practice, but it could get the job done.
Take (long) [dateYouWantToRemember timeIntervalSince1970] and store that in a property file or some such. (You could use timeIntervalSinceReferenceDate, but the 1970 number is the "UNIX epoch date" and more standardized -- you can find converters online to check it.)
Later, under the (potentially) different calendar, do [NSDate dateWithTimeIntervalSince1970:theLongYouStored] and you will reconstruct the date, in the new calendar.
Now use NSCalendar/NSDateComponents to find out the new ordinal day of week of that date, and use [NSDateFormatter weekdaySymbols] to fetch a list of the weekday names. Index the list with the ordinal to fetch the new day name. Use NSDateComponents to do arithmetic on you dates to select the next date that is that day of the week, as needed for your app.

Can Year Constraint removed from the native DatePicker in ios

I am Building an app and I want DatePicker to only Show Month and Day, but not the year. Since Native DatePicker shows Day, Month, Year. Can year be removed from the native DatePicker or is there any way by which we can let the DatePicker show only day and month and not year.Somebody's having any Suggestions? Thanks in advance.
Currently the only available date picker modes are
typedef NS_ENUM(NSInteger, UIDatePickerMode) {
UIDatePickerModeTime,
UIDatePickerModeDate,
UIDatePickerModeDateAndTime,
UIDatePickerModeCountDownTimer
};
So no, if you want to select an actual date the year component always shows. You could however, try to use a regular UIPickerView and update the amount of days in the first component whenever the month changes, although I would not recommend doing so.
What do you need the date picker without a year for, after all?

Resources