こんにちは私は次のphpイベントがあります
public function onRenderDate(Event $event, $propertyValue)
{
// $propertyValue will be something like 1970-01-01,need to split the value in to following format
pr($propertyValue);
pr(getType($propertyValue));
$arr = [
'year' => 2016,
'month' => 07,
'day' => 01
];
return $arr;
}
$ arrをハードコーディングしましたが、$ propertyValue(文字列の日付(2016-10-05T00:00:00 + 00:00)を返す)を$ arrに分割して、個々の値を取得するにはどうすればよいですか?そのような?アイデアの人はいますか?前もって感謝します
public function onRenderDate(Event $event, $propertyValue)
{
$time = strtotime( $propertyValue);
$newformat = date('Y-m-d',$time);
$newformatArr = explode('-',$newformat);
$arr = [
'year' => $newformatArr[0],
'month' => $newformatArr[1],
'day' => $newformatArr[2]
];
return $arr;
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加