use chrono::{Datelike, NaiveDate, Weekday};
fn find_friday_the_13ths(start_year: i32, end_year: i32) {
for year in start_year..=end_year {
for month in 1..=12 {
if let Some(date) = NaiveDate::from_ymd_opt(year, month, 13) {
if date.weekday() == Weekday::Fri {
println!("Friday the 13th: {}-{:02}-13", year, month);
}
}
}
}
}
fn main() {
find_friday_the_13ths(2025, 2031);
}
/*
run:
Friday the 13th: 2025-06-13
Friday the 13th: 2026-02-13
Friday the 13th: 2026-03-13
Friday the 13th: 2026-11-13
Friday the 13th: 2027-08-13
Friday the 13th: 2028-10-13
Friday the 13th: 2029-04-13
Friday the 13th: 2029-07-13
Friday the 13th: 2030-09-13
Friday the 13th: 2030-12-13
Friday the 13th: 2031-06-13
*/