To use [tt]substr()[/tt] you either have to be sure the month and day will be always 0 padded or use [tt]strpos()[/tt] to find out where the separator space is.
function getTimeFromDateStamp( $datestamp ){
return @date('H:i:s', strtotime($datastamp));
}
//the @ is to suppress the warning you might get about not setting the default time zone. ideally you will have done this in php.ini or in prior code.
Feherke's method of string manipulation will be less processor intensive.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.