Important Apex Code for getting Months, Days and Years:
if system date is somewhere in the month of January then :
string monthName = system.now().formatGMT('MMM'); //return JAN
Note : Use M for Month, D for day(days of year), Y for year.
- system.now().formatGMT('MMMMMMMMMMM') :
if system date is somewhere in the month of January then :
string monthName = system.now().formatGMT('MMM'); //return JAN
- DateTime.newInstanceGMT(Date.newInstance(2000, monthCount, 1), Time.newInstance(0, 0, 0, 0)).formatGMT('MMM') :
Note : Use M for Month, D for day(days of year), Y for year.
Comments
Post a Comment