function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hello,
How can i retieve month from the created date of any object in soql or in apex ?
Thanks,
--bdr
Try this:
Account a = [Select a.CreatedDate from Account a limit 1]; Integer month = a.CreatedDate.month();
Another solution is to create a new formula field which contains your month value. The formula will be
MONTH(DATEVALUE(CreatedDate))
Thanks and Best Regards,
Kerwin
Try this:
Account a = [Select a.CreatedDate from Account a limit 1]; Integer month = a.CreatedDate.month();
Another solution is to create a new formula field which contains your month value. The formula will be
MONTH(DATEVALUE(CreatedDate))
Thanks and Best Regards,
Kerwin