Generation

generate functionFri, 24 Feb 2023

return string with the first and the last date from the current month

function get_dates() { $today = new DateTime(); $next_month = new DateTime('first day of next month'); $first_day = $today->format('Y-m-01'); $last_day = $next_month->format('Y-m-01'); return "Das erste Datum ist $first_day und das letzte Datum ist $last_day"; } echo get_dates();

Questions about programming?Chat with your personal AI assistant