php - Parse Date and Time from GET Parameter -


okay pass date , time script using get. right checks exact value database, contains spaces.i want convert 1 line e.g.

2015-03-04-03:03:34 

i want verify string matches timestamp in sql table displays like:

2015-05-03 12:03:23 

thanks

you can use regex patter remove between date , time:

$str = '2015-03-04-03:03:34'; $str = preg_replace('~(\d{4}-\d{2}-\d{2})(.+)(\d{2}:\d{2}:\d{2})~', '$1 $3', $str); echo $str; // 2015-03-04 03:03:34 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -