NSCalendar Find Saturday and Sunday of Current Month - iphone

I am working on project where I want to integrate NSCalendar functionality in my app. Hence I googled and I found this solution. It give me all months in the year and also I can select particular date. that's fine. But I wanted to disable all saturdays and sundays of every month somehow I tried to do it but when I tap previous month or next month it changes the selection. I have gone through almost all stackoverflow questions But I didn't find proper way to do it.
I request you to all Is there any flexible solution on this where I can disable weekends and any particular date. The flow should be like this:
Run the application current month is display and all sat & sun disabled.
When tap on next month or previous month, the respective sat & sun should be disable as per that month.
Functionality for any particular date that I want to disable.

Hello i updated the files and i created an array of disabled days please check the code form here
RootViewController.m file
http://shorttext.com/l7iKEdf
RootViewController.h file
http://shorttext.com/lFaath
just replace these files with the original files from the link you provided
you will find that i added a disabledDays NSMutableArray add any integers to it to it
like following 0 = sat 6 = friday
and that day will be disabled

Related

ical/ics: Better way to do a daily 3-month reminder every year

I am trying to setup a daily 3-month reminder that would occur every year; that is a reminder that occurs daily starting August 1st and ending October 31st, every year. I poured over the RFC and crafted a RRULE that I am sure will work, but I am curious: is there a better way?
RRULE:FREQ=YEARLY;BYMONTH=8,9,10;BYMONTHDAY=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
This ICS is going to be imported into Google calendar.
Yes there is a simpler solution. Just create a rule to recur DAILY but only in months 8, 9 and 10:
FREQ=DAILY;BYMONTH=8,9,10
Your start date should be August 1st.
See the results as generated by recurrence-expansion-service.appspot.com.

Mongodb: how can i generate all days base on current month

I'm wondering if anyone has an elegant solution for generating days based on a month selected for use in a dropdown. What i'm wanting to do is for the user to select the month, then populate a dropdown for days for that month. So for example if the user selected january you would have a dropdown list with values 1 - 31. The only bit i think might be tricky will be to do with leap years, so it may need to pass in year as well. Any ideas would be most appreciated :)
for calendar and get day of month use 'moment'
moment("2012-02", "YYYY-MM").daysInMonth() // 29
moment("2012-01", "YYYY-MM").daysInMonth() // 31

How to calculate recurring/repeating monthly events (e.g. first Friday)?

How to calculate dates for things like 1st Friday or 3rd Saturday?
I took Dave Peterson's answer from 2005(!) and adapted it a bit so you can drag down in google sheets.
Example for 3rd saturdays:
In A1, put "DATE(YEAR(TODAY()),MONTH(TODAY()),1+7*3)
-WEEKDAY(DATE(YEAR(TODAY()),MONTH(TODAY()),8-7))"
In A2, put "DATE(YEAR(A1),MONTH(A1)+1,1+7*3)
-WEEKDAY(DATE(YEAR(A1),MONTH(A1)+1,8-7))"
That will calculate the year based off your current date. The part that is controlling the week number (ie 3rd or 1st) is that 7*3(3rd week) part. That part that is controlling the day of the week is the 8-7 part. Still trying to grok that. The +1 is adding a month, thus allowing you to do a fill down.
Test this against google calendar to get it right. Hope this can help someone stuck!
Make a copy of it if you'dlike: https://docs.google.com/spreadsheets/d/1lOroSjy9EXLoiu-kDE3w1EMWw42HMIG7YJ3iGNhpl34/edit?usp=sharing
For the first five mondays from March 2018,
=ARRAYFORMULA(WORKDAY.INTL(DATE(2018,3,),ROW(A1:A5),"0111111"))
Uses string method of WORKDAY.INTL to declare specific weekday as the only working day.
For third Saturday of each month from March 2018,
=ARRAYFORMULA(WORKDAY.INTL(DATE(2018,ROW(A3:A12),),3,"1111101"))

Altering x-axis for dates in Tableau

I have a data set that has dates for many years. I can easily filter the data by month or week, but I was hoping to change the X axis to make it start in October and end in April.
Is there a way to do this in Tableau without altering the original data and listed dates?
I don't know about it ending in April since that would not be a full 12 months but you can make it start in October. Right click on your date field > Default Properties > Fiscal Year Start. Then select October.

How to get last day of the month in Cocoa?

I would like to make a function that input a NSDate and output the last date of the month. Do you guys know how to do it in Cocoa?
It's the day before the first day of the next month. Add a month, set the day to 1, subtract a day. For setting the day to 1, you'll find it easier to go via NSCalendar. See here for details.
If you're doing date computations, you should always use NSCalendar and related classes, because that's the only way to be forward-compatible with changes to calendars, support for non-"standard" calendars, and so on.
Read the Date and Time Programming Guide section on Calendrical Calculations to get an idea of how these classes work together.