删除IntlDateFormatter中的时间部分

I would like to output a localized date and have tried this:

$time = new DateTime();
echo IntlDateFormatter::formatObject($time)."
";
echo IntlDateFormatter::formatObject($time, [IntlDateFormatter::NONE, IntlDateFormatter::MEDIUM])."
";
echo IntlDateFormatter::formatObject($time, [IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE])."
";

I get this output:

Oct 28, 2015, 2:10:50 PM
2:10:50 PM
20151028 02:10 PM

So removing the datepart works fine, but not removing the time part. What am I doing wrong?

You can try it out here: https://3v4l.org/UdtoX

Edit:

The reason I want to use IntlDateFormatter is to get i18n of the date. For example, I should get different results if I set Locale::setDefault('en_GB') and if I set Locale::setDefault('no_NO') before using IntlDateFormatter. Therefore I don't want to specify the format manually.

It seems to be a bug in PHP. By creating an object instead of calling the static method it works :)

$formatter = new IntlDateFormatter(Locale::getDefault(), IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE);
echo $formatter->format($time);

Gives the desired output Oct 28, 2015.

<?php
$date = new DateTime();

$dateFormatter = IntlDateFormatter::create(
  Locale::getDefault(),
  IntlDateFormatter::NONE,
  IntlDateFormatter::NONE,
  date_default_timezone_get(),
  IntlDateFormatter::GREGORIAN,
  'MM/dd/yyyy'
);

var_dump($dateFormatter->format($date));