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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -