You need to sign in to do that
Don't have an account?
krishna1
How to get current week records in apex
Hi All,
How to get current week records using soql query, I want to display this week records Sunday to Saturday created records. Help me please.
Thanks
Gopi
you can write soql like this
SELECT Id FROM Account WHERE CreatedDate < THIS_WEEK
see the below url for the reference
http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm
All Answers
you can write soql like this
SELECT Id FROM Account WHERE CreatedDate < THIS_WEEK
see the below url for the reference
http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm
Shouldn't it be "WHERE CreatedDate = THIS_WEEK"?
-Hengky-
Yes You Can use That as
SELECT Id FROM Account WHERE CreatedDate < THIS_WEEK
THIS_WEEK:
Starts 12:00:00 on the most recent first day of the week
before the current day and continues for seven full days.
First day of the week is determined by your locale
If you want to know Records crated in last 7 Days, can just go with
SELECT Id, CreatedDate FROM Account WHERE CreatedDate = LAST_N_DAYS:7
Or if you want to know the records created from the first day of this week, then just go with
SELECT Id, CreatedDate FROM Account WHERE CreatedDate = THIS_WEEK
see the below link for reference
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm
- Sudheer Ravada-