/** * Formats a point in time as a string in a specified time zone according to a specified pattern and the formatting * rules used in the default or some other locale and returns the formatted string. * * The formatting patterns that you can use to format a point in time with this method are described in * [Date Format Patterns](http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) of the Unicode * Technical Standard #35. * * @param CTime $time The point in time to be formatted. * @param CTimeZone $timeZone The time zone in which the components in the resulting string are to appear. * @param string $pattern The formatting pattern. * @param CULocale $inLocale **OPTIONAL. Default is** *the application's default locale*. The locale in which the * point in time is to be formatted. * * @return CUStringObject A string with the formatted point in time. */ public static function timeWithPattern(CTime $time, CTimeZone $timeZone, $pattern, CULocale $inLocale = null) { assert('is_cstring($pattern)', vs(isset($this), get_defined_vars())); $locale = isset($inLocale) ? $inLocale->name() : CULocale::defaultLocaleName(); $intlDateFormatter = new IntlDateFormatter($locale, IntlDateFormatter::FULL, IntlDateFormatter::FULL, $timeZone->ITimeZone(), null, $pattern); $strTime = $intlDateFormatter->format($time->UTime()); if (is_cstring($strTime)) { return $strTime; } else { assert('false', vs(isset($this), get_defined_vars())); return ""; } }