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
//Say you have a date type variable called'myDate' Integer month = myDate.month();
Please try this link and you will get your solution ,if not then give more info about your requirement.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_date.htm
Thanks
Shivdeep
Try something like this:
Note: Your query should be how to get month from Date.
If you want date from month then it is not possible.
Let me know if it helps
Thanks!
Please refer to below code.
public class DateFromMonth {
public static void gettodayDate()
{
Date todaydate = system.today();
Integer todayDay = todayDate.day();
Integer todayMonth = todayDate.month();
System.debug('Todays Day--->'+todayday);
System.debug('Todays Month--->'+todayMonth);
}
}
Please let me know if this help!
Please mark it as best if you find it helpful.
Thank You
Ajay Dubedi