Questions tagged [date-literals]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
88 views

Date literals returning nothing in Apex Test

I'm doing the following in a test class. First inserting one record and then doing a record count to see that there is still only the one record in the DB. However when the query runs I get 0 records ...
6
votes
2answers
8k views

LAST_N_MONTHS:N in SOQL

Has anyone ever faced an issue with LAST_N_MONTHS:N in SOQL? As per salesforce doc: For the number n provided, starts 00:00:00 of the last day of the previous month and continues for the past n ...
21
votes
2answers
22k views

Does LAST_N_DAYS:1 Include TODAY?

I would like to ask about the definition of LAST_N_DAYS:n For the number n provided, starts 00:00:00 of the current day and continues for the past n days. Is CreatedDate = LAST_N_DAYS:1 equal ...
8
votes
2answers
3k views

Documentation for hidden SOQL date literals (e.g. N_DAYS_AGO)

The current documentation for SOQL Date Literals does not have N_X_AGO on its list. In fact I had never seen the AGO date literals on any version of the documentation. So I am wondering if there are ...
5
votes
2answers
1k views

replacing LAST_MONTH

I have some code that depends on LAST_MONTH. Something like: select .... date__c .. FROM myTable__c where date__c = LAST_MONTH This code, as I understand, returns a result set constrained to ...
2
votes
1answer
142 views

How Do I Set Up Fiscal Trimesters, Anyway?

I had some fun over the weekend trying to answer this question: How do SOQL date literals behave with fiscal years that differ from one year to the next. However, I was kind of shocked by how ...
2
votes
3answers
688 views

How to do a query with one specific date

I want to do a query that excludes today and yesterday. I tried to do it in this way: CreatedDate != today AND CreatedDate != yesterday Is there any other way to do it?
11
votes
1answer
1k views

How do SOQL date literals behave with fiscal years that differ from one year to the next

Let's say that in 2013 and 2014 a business used trimesters, and then in 2015 it switched to quarters. How will queries that use the LAST N FISCAL QUARTERS literal work? SELECT Id FROM Account WHERE ...