You need to sign in to do that
Don't have an account?
Eric_SalesForce
Date Functions in SOQL
Hi I have a SQL query that I want to setup through SalesForce, it querys where someDate >= (date manipulation to get last monday to last sunday).
I want to query the same way on salesforce and im not sure how I can win the existsing Date Functions available.
I wanted to use LAST_WEEK but that gets me sunday - saturday which isn't what I wanted, I was hoping do something like:
where someDate >= LAST_WEEK + 1 AND where someDate >= LAST_WEEK + 6
Is this possible?
thanks
I want to query the same way on salesforce and im not sure how I can win the existsing Date Functions available.
I wanted to use LAST_WEEK but that gets me sunday - saturday which isn't what I wanted, I was hoping do something like:
where someDate >= LAST_WEEK + 1 AND where someDate >= LAST_WEEK + 6
Is this possible?
thanks
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Date_instance_methods.htm
All Answers
date d = system.today().addDays(+1); // It will add 1 day to current day.
Account [] acc= [select id from account where createdDate = :d];
To know more about this metod.Please refer below link :-
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Date_addDays.htm
Apex Controller :
//Author - Harshit Pandey
//Blog - http://www.oyecode.com
public class dateHandler{
public Date theDay { get { return Date.today().toStartofWeek().addDays(-2); }}
//class to handle the dates
public dateHandler()
{
}
}
Visualforce Page Code :
<apex:page showHeader="false" sidebar="false" controller="dateHandler">
<apex:iframe src="http://www.oyecode.com" scrolling="true" id="theIframe"/>
<apex:outputText value="{!theDay}" />
</apex:page>
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Date_instance_methods.htm