首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

IntlCalendar::isEquivalentTo

(PHP 5.5.0, PHP 7, PECL >= 3.0.0a1)

IntlCalendar::isEquivalentTo — Whether another calendar is equal but for a different time

Description

Object oriented style

代码语言:javascript
复制
public bool IntlCalendar::isEquivalentTo ( IntlCalendar $other )

Procedural style

代码语言:javascript
复制
bool intlcal_is_equivalent_to ( IntlCalendar $cal , IntlCalendar $other )

Returns whether this and the given object are equivalent for all purposes except as to the time they have set. The locales do not have to match, as long as no change in behavior results from such mismatch. This includes the timezone, whether the lenient mode is set, the repeated and skipped wall time settings, the days of the week when the weekend starts and ceases and the times where such transitions occur. It may also include other calendar specific settings, such as the Gregorian/Julian transition instant.

Parameters

cal

The IntlCalendar resource.

other

The other calendar against which the comparison is to be made.

Return Values

Assuming there are no argument errors, returns TRUE iif the calendars are equivalent except possibly for their set time.

Examples

Example #1 IntlCalendar::isEquivalentTo()

代码语言:javascript
复制
<?php
$cal1?=?IntlCalendar::createInstance('Europe/Lisbon',?'pt_PT');
$cal2?=?IntlCalendar::createInstance('Europe/Lisbon',?'es_ES');
$cal2->clear();

var_dump($cal1->isEquivalentTo($cal2));?//?true

$cal3?=?IntlCalendar::createInstance('Europe/Lisbon',?'en_US');
var_dump($cal1->isEquivalentTo($cal3));?//?false
var_dump($cal1->getFirstDayOfWeek(),????//?2?(Monday)
$cal3->getFirstDayOfWeek());????????????//?1?(Sunday)

The above example will output:

代码语言:javascript
复制
bool(true)
bool(false)
int(2)
int(1)

See Also

  • IntlCalendar::equals() - Compare time of two IntlCalendar objects for equality

← IntlCalendar::inDaylightTime

IntlCalendar::isLenient →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com