2016-03-19 10 views
0

私はspesicif文字、例空間まで単語を取得したいと思います。私はsubstrを使用しようとしているが、私は傾ける。phpの文字列で指定文字を取得する方法

1. 3/14/2016 13:46 

i would like to get 3/14/2016 and showing it. is that possible? 



2. 3/14/2016 13:46 
i would like to get 13.46 without date. is that possible? 

誰かがどのように上記2ケースから文字列を取得するために私を伝えることができます:

Assumming iは、列のデータを持っています。

おかげでたくさん

+0

あなたは ')('のstrtotimeを見てみました – user3284463

答えて

0

列はスペースが区切られている場合は、あなたが爆発し、あなたが望むその列のインデックスを引っ張って使用することができます。

$rowData = "1. 3/14/2016 13:46"; 

$rowCols = explode(" ",$rowData); 

echo $rowCols[1]; // returns 3/14/2016 
echo $rowCols[2]; // returns 13:46 
0
$specifidCharacter = " " //Space for example 
$string = "1. 3/14/2016 13:46"; 

$tmp = explode($specificCharacter, $string); 
echo $tmp[1] //Case 1 
echo $tmp[2] //Case 2