dbnewbie
asked on
PHP GetYear, GetMonth, & GetDay Functions
Does PHP have GetYear, GetMonth, & GetDay Functions? For example:
$Date = 2003-3-3;
$Year = GetYear($Date); // yields 2003
and so on . . .
$Date = 2003-3-3;
$Year = GetYear($Date); // yields 2003
and so on . . .
or the date function
http://www.php.net/manual/fr/function.date.php
http://www.php.net/manual/fr/function.date.php
ASKER
Laurly,
Your assumption is that I am going to obtain the date from the system. Actually, I am going to get it from a database. Also, it will only contain date information (no time). Will what your suggesting work with that? The field type in the database is Date/Time.
Your assumption is that I am going to obtain the date from the system. Actually, I am going to get it from a database. Also, it will only contain date information (no time). Will what your suggesting work with that? The field type in the database is Date/Time.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Note that a DATETIME containing no time part is supposed to be called a DATE field :D
http://www.php.net/manual/en/function.getdate.php
$today = getdate();
$month = $today['month'];
$mday = $today['mday'];
$year = $today['year'];
echo "$month $mday, $year";
laurly