You need to sign in to do that
Don't have an account?
CreatedDate not returning or able to query correctly form SOQL
I am having an issue getting a SOQL query to return the proper results when the WHERE clause is using the CreatedDate. I hear about the UTC/GTM but don't fully understand how to get the proper results.
Today is 7/21 and I have records that show on the standard SF page for Created Date as 7/20/2018 and 7/21/2018; however, when I use in code or the Developer Console I only see CreatedDate values of 7/21/218Tnn:nn:nn.000+0000.
If I us the following WHERE clause (...WHERE CreatedDate < 2018-07-21T00:00:00Z) I get no records back but if I change the 21 I do get records back but again they all show as 07/21...
However, when I use the following WHERE clause (WHERE CreatedDate < TODAY) I get records back but they still show as 07/21/2018...
From my code persective I am trying to delete record based on a specific date in the past.and although the requirement is that that specific that it can't be off a bit but this issue is really bothering me that I can't easily delete the records starting on a specific date using a query in apex like below and accurately.
DELETE [ SELECT id from mytablename__c WHERE CreatedDate < :calculatedDate LIMIT 9999];
Your help is very much appreciated - thank you in advance.