+ Start a Discussion
Purushottam Dank 1Purushottam Dank 1 

check leap year, program in apex?

hello everyone, i want to check entered year is leap year or not , what is code for this in apex ?
Harish RamachandruniHarish Ramachandruni
HI,

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_date.htm
 
isLeapYear(year)
Returns true if the specified year is a leap year.
Signature
public static Boolean isLeapYear(Integer year)

Parameters
year
Type: Integer
Return Value
Type: Boolean

Example


system.assert(Date.isLeapYear(2004));




Thanks,
Harish R.