You need to sign in to do that
Don't have an account?

Function to determine the age of a particular date
Hi,
Is there any handy function that allows me to determine the age (ie: number of days) of a particular
date? I would like to use this kind of function for my SQSL statement to pull the records that
are 7 days old or less based on the publication date field. Please advice.
thanks
Paul
You might want to use last_n_days date literal like this -
> WHERE PublicationDate = LAST_N_DAYS:7
Thanks for your reply. I tried the following SOQL statement and it gave me an error message that says
"unexpected token: LAST_N_DAYS". Please advice.
Select Id, Title, CreatedDate From ContentVersion where CreatedDate = LAST_N_DAYS:7
Following is the syntax
SELECT Id FROM Account WHERE CreatedDate = LAST_90_DAYS
For more details, check the following link.
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm
This SOQL statement actually works. thanks so much.
Select Id, Title, CreatedDate From ContentVersion where CreatedDate = LAST_N_DAYS:7