What Are The Date Methods In Apex?

date_methods_in_salesforceDate Methods:
             We Need to know the date methods to write a efficient Queries in SOQL and SOSL. 
The following are the instance methods for Date.
Name Arguments Return Type Description
addDays Integer addlDays Date
Adds the specified number of addlDays to a Date. For example: 
date myDate = 
date.newInstance(1960, 2, 17); 
date newDate = mydate.addDays(2);
addMonths Integer addlMonths Date Adds the specified number of addlMonths to a Date
addYears Integer addlYears Date Adds the specified number of addlYears to a Date
day Integer Returns the day-of-month component of a Date. For example, February 5, 1999 would be day 5.
dayOfYear Integer Returns the day-of-year component of a Date. For example, February 5, 1999 would be day 36.
daysBetween Date compDate Integer Returns the number of days between the Date that called the method and the compDate. If the Date that calls the method occurs after the compDate, the return value is negative. For example:

date startDate = 
date.newInstance(2008, 1, 1); 
date dueDate = 
date.newInstance(2008, 1, 30); 
integer numberDaysDue = 
startDate.daysBetween(dueDate);
format String Returns the Date as a string using the locale of the context user
isSameDay Date compDate Boolean
Returns true if the Date that called the method is the same as the compDate. For example: 

date myDate = date.today(); 
date dueDate = 
date.newInstance(2008, 1, 30); 
boolean dueNow = myDate.isSameDay(dueDate);
month Integer Returns the month component of a Date (1=Jan)
monthsBetween Date compDate Integer Returns the number of months between the Date that called the method and the compDate, ignoring the difference in dates. For example, March 1 and March 30 of the same year have 0 months between them.
toStartOfMonth Date Returns the first of the month for the Date that called the method. For example, July 14, 1999 returns July 1, 1999.
toStartOfWeek Date
Returns the start of the week for the Date that called the method, depending on the context user's locale. For example, the start of a week is Sunday in the United States locale, and Monday in European locales. For example: 

date myDate = date.today(); 
date weekStart = myDate.toStartofWeek();
year Integer Returns the year component of a Date

COMMENTS

Name

Apex Apex Default Methods Apex Methods Apex_Collections Apps Batch Apex Books CRM eBooks Data Import Wizard Data Management DataLoader Dataloader.io Difference Between Error in Salesforce FAQ's FAQ's-Apex FAQ's-Apps FAQ's-CRM FAQ's-Data loader FAQ's-SOQL & SOSL FAQ'S-Triggers FAQ's-User Profile & Security FAQ's-VF Force.com Explorer Force.com Ide Formulas & Functions Integration Interview Questions Only Latest_Updates Limits&Best Practices Online-Training Reports and Dashboards Salesforce Deployment Salesforce Realtime Examples On Development Salesforce Realtime Task On Admin Salesforce Realtime Tasks Salesforce Realtime Tasks- Apex Salesforce Training Salesforce1 Mobile Sites SOQL Spring'14 Release Triggers User Profile & Security VF Tags VisualForce Winter'14 Release Wizard for Accounts/Contacts Workbench Workflows and Approvals
false
ltr
item
Sfdc Gurukul- All in one place for salesforce and force.com step by step tutorial for beginners: What Are The Date Methods In Apex?
What Are The Date Methods In Apex?
What Are The Date Methods In Apex?,date methods in salesforce,date format methods in salesforce,soql date methods in salesforce,date time methods in salesforce
http://3.bp.blogspot.com/-SsA3_9SaR7k/U05nwoil8NI/AAAAAAAABvc/BuCf5WwWL0c/s1600/date_methods_in_salesforce.jpg
http://3.bp.blogspot.com/-SsA3_9SaR7k/U05nwoil8NI/AAAAAAAABvc/BuCf5WwWL0c/s72-c/date_methods_in_salesforce.jpg
Sfdc Gurukul- All in one place for salesforce and force.com step by step tutorial for beginners
http://sfdcgurukul.blogspot.in/2013/07/what-are-date-methods-in-apex.html
http://sfdcgurukul.blogspot.in/
http://sfdcgurukul.blogspot.com/
http://sfdcgurukul.blogspot.com/2013/07/what-are-date-methods-in-apex.html
true
4199533888133360731
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy