function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Niharika GoudNiharika Goud 

How to get the date from Month in apex class

Hi ..,

I am New To SFDC
Plz help me anyone..,
Shivdeep KumarShivdeep Kumar
Hi Niharika,
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
Narender Singh(Nads)Narender Singh(Nads)
Hi Niharika,
Try something like this:
//Say you have a date type variable called'myDate'
Integer month = myDate.month();

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!
Ajay K DubediAjay K Dubedi
Hi Niharika,

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