Monday, 26 August 2013

PHP remove timestamp from string

PHP remove timestamp from string

In a PHP script I need to remove the 00:00:00 from "2003-01-28 00:00:00".
No matter what numbers are in the 00:00:00 it should be stripped if
exists. Is there some sort of formula (regex maybe?) that can detect and
remove it?
Additionally, the 00:00:00 may not always be in the string. That's why I
need to detect it first.
How would I go about this? Any ideas or functions?

No comments:

Post a Comment