check NSDate in month - nsdate

I have NSDate object and I need to find from a NSArray (that has nsdate objects) all objects that have the same month and year.

This earlier answer shows you how to get the month and day information. You can use it to do what you are asking:
NSDate get year/month/day

Related

How do you get the day out of a Date object since "getDay()" is deprecated?

When the user opens my app the date is recorded. Then it's compared with the last date that was recorded. I want to be able to tell if just the day changed between the 2. And I don't want to simply see if 24 hours lapsed. The user should be able to open the app at 11:59pm, and then again in 2 minutes and the code should tell that the day has changed. Thanks for your help!
I found a solution that solves my problem (although technically doesn't directly get the day out of the Day object.)
Comparing two java.util.Dates to see if they are in the same day
Basically make a Calendar object and call it's "setTime()" method with my Date object as the argument, then use ".get(Calendar.DAY_OF_YEAR) to get the day from each Calendar object.
You are right, and if you want to get the actual day you just need to use Calendar.getInstance() like this:
Calendar cal = Calendar.getInstance();
int day = cal.get(Calendar.DAY_OF_MONTH);

Is it possible to subtract x number of days from todays date in Azure Data Factory

I have the GetMetaData activity that returns a 'lastmodifieddate'. Is there anyway in Azure DF to take the current date (today) and then subtract 3 days from today to compare against the 'lastmodifidedate'?
Is there anyway in Azure DF to take the current date (today) and then
subtract 3 days from today to compare against the 'lastmodifidedate'?
#equals(formatDateTime(addDays(utcnow(),-3),'yyyy-MM-dd'),formatDateTime(activity('Your Metadata Activity Name').output.lastmodifieddate,'yyyy-MM-dd'))
In order to compare the dates or any value, you have to make use of Logical Function. Here the equals method compares two values and return boolean value. Please find more details about logical function on MSDN
formatDateTime function helps us to modify the format of any datetime. Since you need to compare the date part we have made use of 'yyyy-MM-dd' format.
addDays method helps us in adding any number of days to the datetime.
utcNow() method returns the current UTC date time value.
Please find complete details about functions here.

How can i modify DATEDIFF to find results in the past?

I have created a Visual Studio report (database is dynamics crm 2011). This report shows me from now (today) all elements 13 months in the past.
DATEDIFF(Month, CRMAF_FilteredQuote.createdon, CURRENT_TIMESTAMP) <=13;
How should I modify this statement to get the results from the final day of the previous month? For example all documents from the 30th September through to 1st August?
Thank you very much for your ideas.
Peter
You can get last day of previous month using below given query
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))
To find all documents created between two dates (last day of previous month and today), use below given query
SELECT *
FROM Entity_Name
WHERE CreatedOn Between DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)) AND GETDATE()

Excel Subtract months from specified date?

How will i subtract months from specified date using datediff function?
for example:
17/10/2013 -(3 months) = 17/07/2013?
If your input is in A1, this will give you the date 3 months earlier:
=DATE(YEAR(A1),MONTH(A1)-3,DAY(A1))
Date creates a date given the year, month, and day provided. It will handle negatives correctly (so it will work in February, adjusting the year as needed.)
Datedif returns the difference between two given dates -- the reverse of what you're looking for.
Datediff is a function in MS SQL and Access.

How to know the current quarter with date?

Is it possible to know the current quarter using Linux command line?
I didn't find a way to do it within the date man page.
The dates corresponding to the start and end of a fiscal quarter vary by country, as well by the nature of the entity doing the fiscal reporting (corporate/personal/government/other...); some companies also have alternate schedules. As such, there is no standard API for this. You will have to get the current month and date and compare it to the appropriate quarter start/end dates for the country and entity of interest. You can find the dates for some countries in wikipedia.
There is now the %q format to show this information.
From the coreutils-8.26 release log from November 30, 2016:
New Features
...
date now accepts the %q format to output the quarter of the year.
And yes it works!
$ date "+%q"
4
$ date "+%Y%q"
20164

Resources