You need to sign in to do that
Don't have an account?
Get next September 1 as a Date?
How can I take Today() and then get back, for example, the next September 1 that will come?
Basically, if Today() returns 8/10/2019, I want to replace the month value with "9" and the day value with "1" but I don't know how to write it so that Apex will accept my manipulated XX/XX/XXXX as a date.
Basically, if Today() returns 8/10/2019, I want to replace the month value with "9" and the day value with "1" but I don't know how to write it so that Apex will accept my manipulated XX/XX/XXXX as a date.
Please use the below code:
Date today = system.Today();
Date newDate = date.newinstance(today.year(), 9, 1);
system.debug('@@@ newDate ==> '+ newDate );
Can you please Let me know if it helps or not!!!
If it helps don't forget to mark this as a best answer!!!
Thanks,
Maharajan.C
All Answers
Please use the below code:
Date today = system.Today();
Date newDate = date.newinstance(today.year(), 9, 1);
system.debug('@@@ newDate ==> '+ newDate );
Can you please Let me know if it helps or not!!!
If it helps don't forget to mark this as a best answer!!!
Thanks,
Maharajan.C