skcin7
02-25-2010, 09:20 PM
Hi all. I have a function which I am writing which takes a datetime as its parameter, and I want it to return a 2 digit representation of year, but I can't figure out for the life of me how to do this! Can anybody tell me what I need to do with my code to get this to work? Thanks!
This is what I have so far
function datetimeGetYear($datetime)
{
$year = explode("-", $datetime); // 4 digit representation of year is now stored in $year[0]
return $year[0]; // Stub... I need this to return a 2 digit representation of the year, not a 4 digit.
}
This is what I have so far
function datetimeGetYear($datetime)
{
$year = explode("-", $datetime); // 4 digit representation of year is now stored in $year[0]
return $year[0]; // Stub... I need this to return a 2 digit representation of the year, not a 4 digit.
}