Printing the Name of a Day according to the Numeric Date (ie: mm,dd,yyyy)

Category: Software and Systems Engineering
Author: Sean O'Donnell
Thu, Feb. 20th, 2003 @ 2:20:22 (MST)

This example will show you a simple home-made function that returns the name of a day from the numeric value of the date.

<?php
/**
 * get_name_day($int_Month,$int_Day,$int_Year)
 * returns the name of the day determined by the integar value of the date (mm/dd/yyyy)
*/
function get_name_day($int_Month,$int_Day,$int_Year) {
    if (
is_numeric($int_Month) && is_numeric($int_Day) && is_numeric($int_Year)) {
        return 
date("l",mktime (0,0,0,$int_Month,$int_Day,$int_Year));
    } else {
        return 
$int_Day;
    }
}
print 
get_name_day(12,25,2003);
?>

The results from the example above, should be:

Thursday

Copyleft (<) 1998-2019 www.seanodonnell.com