You need to sign in to do that
Don't have an account?
SF DEV
How to get Month from a date field
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
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 :)
All Answers
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 :)
Yes, i referred.....i have resolved it
date d=c.c.Contract_Start_Date__c;
Integer dtMonth = d.month();