objective c - How can I determine if the current date is within/outside a range of two dates that don't include a year? -


I have an object where I want to select an initial date and an expiration date for users Allow me

The user is basically a center / center that provides activities for the public.

They have the option to make these activities seasonal. So for example an activity can run from 01 February to 22 June. I use the current date to determine whether activity is in season or not.

For example, if I check the current date is 271014, the start date is more than 020114 and the end date is less than 062214. If so, then it means that the date range is

issue:

I have to make changes, so now only a month and a day Must choose. It's fine until they pick something from November 1 to 28. These dates will be in the format of 1101 and 2802.

Without year, it clearly gives me different results, along with the year, I would be able to determine that the date of expiry was one year of the beginning of 28th February and not the same year. Then while working, I am expected to have the expected result when the current date is in the beginning and end date.

What I'm currently doing

Without the year, the expiration date is not really much longer than the start date. I solve this issue? I really need to give a user permission to set a start date and an end. Activity will appear in a table view, when the current date range is reached.

If only an expiration date is selected, the activity will be terminated, until the expiry date is reached. Even if I set and end date for 28th February and the same date we are in November also apply to the start date

Here some insights will be appreciated.

Thank you for your time. Here's my suggestion (in pseudo code): In the example "MMdd" format, the stars have all the dates Convert to

  startDate = "1101" // 1 November end date = "0228" // February 28 currentDate = "1027" // October 27  
< P> If startDate & lt; = Expiry date then the limit is within the same year and you can check the current date with

  if (startDate & lt; = currentDate & current date & lt ; = Expiry date) ...  

Otherwise the limit starts in one year and ends in the next year, and you check with

  (If currentDate> = startDate; currentDate & lt; = expiry date) ...  

Comments