+ 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.

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
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