Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- How to get Month from a date field
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
How to get Month from a date field
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-12-2012 06:38 PM
c.Contract_Start_Date__c
this id a date field type.
I need to get month from the above date in trigger code.
Eg: c.Contract_Start_Date__c =13/12/2012
then i need Month= DEC
Solved! Go to Solution.
Re: How to get Month from a date field
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-12-2012 08:19 PM
Integer dtMonth = c.Contract_Start_Date__c.month();
The method ".month()" returns an integer, so if your date is 11/11/2012, it will return you '11'. To get the Month Name, write some logic that returns you the month name when you pass the month number to it.
Make a habit of referring the developer guides before directly posting queries here. Will help you learn in a better way :)
Kudos a post if it helps, mark it as solution if it solves.
http://exploretheforce.blogspot.in
Re: How to get Month from a date field
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-12-2012 08:25 PM
Yes, i referred.....i have resolved it
date d=c.c.Contract_Start_Date__c;
Integer dtMonth = d.month();

