function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
srini.SFDCsrini.SFDC 

condition for first 15 days of every month in a year in SOQL query

Hi,

I need to query, criteria of first 15 days of every month in a year in soql query.




Thanks In Advance.
CheyneCheyne
I'm not sure if you can pull this off with just a SOQL query. You can, however, create a formula field using the DAY function, which returns the day of the month of a date. So, if your date field is called Date__c, and you define a formula field called Day_of_Month__c, as follows,

DAY(Date__c)

then you could write a query like 

SELECT Id FROM ObjectName WHERE Day_of_Month__c <= 15