Initialize leap = false

If (year%400 = 0), then leap = true

If (year%4 =0 AND year%100 ≠ 0) then leap = true

print leap

An algorithm to take the leap is in Wikipedia http://en.wikipedia.org/wiki/Leap_year

The following pseudocode determines whether a year is a *leap year* or a *common year* in the Gregorian calendar (and in the proleptic Gregorian calendarbefore 1582). The *year* variable being tested is the integer representing the number of the year in the Gregorian calendar, and the tests are arranged to dispatch the most common cases first. Care should be taken in translating mathematical integer divisibility into specific programming languages.

**if** ( *year* is not divisible by 4) **then** (it is a common year)

**else**

**if** ( *year* is not divisible by 100) **then** (it is a leap year)

**else**

**if** ( *year* is not divisible by 400) **then** (it is a common year)

**else** (it is a leap year)

Other examples here: https://www.google.com/search?q=android+leap+year&oq=android+leap+year&aqs=chrome..69i57.4303j0j7&sourceid=chrome&es_sm=93&ie=UTF-8

Another way "I tested having the app set the date picker to Feb 29th but it crashes if there is no Feb 29th on the current year." is if there is an error, you might be able to tell the app this is a leap year using the Screen1.ErrorOccured block to trap the mistake.

However, since your app is not going to be around forever, you just might note the leap years in the next 18 years and compare them with the year of interest:

### Leap Years 2008 – 2032

Year | February 29 – day of the week |
---|---|

2008 | Friday |

2012 | Wednesday |

2016 | Monday |

2020 | Saturday |

2024 | Thursday |

2028 | Tuesday |

2032 | Sunday |

or just about forever:

The next leap year will be in 2012. The leap year will then occur successively every 4 years so it will follow in 2016, 2020, 2024, and so forth. However, as we can see from the leap years listed below - there are years in which we do not have a leap year. This is as a result of the Gregorian calendar which has us skip a leap year every 100 years to make up for the fact that 11 minutes had to be shaved off the 365.25 year.

**Leap Year list from 1,900 to 2,400:**

1904

1908

1912

1916

1920

1924

1928

1932

1936

1940

1944

1948

1952

1956

1960

1964

1968

1972

1976

1980

1984

1988

1992

1996

2000 2004

2008

2012

2016

2020

2024

2028

2032

2036

2040

2044

2048

2052

2056

2060

2064

2068

2072

2076

2080

2084

2088

2092

2096 2104

2108

2112

2116

2120

2124

2128

2132

2136

2140

2144

2148

2152

2156

2160

2164

2168

2172

2176

2180

2184

2188

2192

2196 2204

2208

2212

2216

2220

2224

2228

2232

2236

2240

2244

2248

2252

2256

2260

2264

2268

2272

2276

2280

2284

2288

2292

2296 2304

2308

2312

2316

2320

2324

2328

2332

2336

2340

2344

2348

2352

2356

2360

2364

2368

2372

2376

2380

2384

2388

2392

2396

2400

Try this, to be a leap year, the year number must be divisible by four – except for end-of-century years, which must be divisible by 400

ODD_EVEN_1.aia (2.9 KB)

Thank you so much

another way to check leap year:

make a date of 1st March of some year, minus one day, check the date is 28 or 29.

here is the simple logic to determine whether the given year is a leap year or not,

```
Initialize leap = false
If (year%400 = 0), then leap = true
If (year%4 =0 AND year%100 ≠ 0) then leap = true
print leap
```

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.