PHP.mk документација

IntlCalendar::fieldDifference

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

intlcalendar.fielddifference.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека intlcalendar.fielddifference.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
IntlCalendar::fieldDifference

Референца за `intlcalendar.fielddifference.php` со подобрена типографија и навигација.

intlcalendar.fielddifference.php

IntlCalendar::fieldDifference

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

IntlCalendar::fieldDifferenceCalculate difference between given time and this objectʼs time

= NULL

Напиши целосна ознака на елемент

public IntlCalendar::fieldDifference(float $timestamp, int $field): int|false

Процедурален стил

intlcal_field_difference(IntlCalendar $calendar, float $timestamp, int $field): int|false

Return the difference between the given time and the time this object is set to, with respect to the quantity specified the field parameter.

This method is meant to be called successively, first with the most significant field of interest down to the least significant field. To this end, as a side effect, this calendarʼs value for the field specified is advanced by the amount returned.

Параметри

calendar

Еден IntlCalendar instance.

timestamp

The time against which to compare the quantity represented by the field. For the result to be positive, the time given for this parameter must be ahead of the time of the object the method is being invoked on.

field

The field that represents the quantity being compared.

вистинска функција, само прототип за тоа како треба да биде функцијата. IntlCalendar date/time константи на поле. Овие се цели броеви помеѓу 0 and IntlCalendar::FIELD_COUNT.

Вратени вредности

Returns a (signed) difference of time in the unit associated with the specified field or false при неуспех.

Примери

Пример #1 IntlCalendar::fieldDifference()

<?php
ini_set
('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'fr_FR');

$cal1 = IntlCalendar::fromDateTime('2012-02-29 09:00:11');
$cal2 = IntlCalendar::fromDateTime('2013-03-01 09:19:29');
$time = $cal2->getTime();

echo
"Time before: ", IntlDateFormatter::formatObject($cal1), "\n";

printf(
"The difference in time is %d year(s), %d month(s), "
. "%d day(s), %d hour(s) and %d minute(s)\n",
$cal1->fieldDifference($time, IntlCalendar::FIELD_YEAR),
$cal1->fieldDifference($time, IntlCalendar::FIELD_MONTH),
$cal1->fieldDifference($time, IntlCalendar::FIELD_DAY_OF_MONTH),
$cal1->fieldDifference($time, IntlCalendar::FIELD_HOUR_OF_DAY),
$cal1->fieldDifference($time, IntlCalendar::FIELD_MINUTE)
);

//now it was advanced to the target time, exception for the seconds,
//for which we did not measure the difference
echo "Time after: ", IntlDateFormatter::formatObject($cal1), "\n";

Пример #1 Пример што покажува затворачка ознака што го опфаќа последниот нов ред

Time before: 29 févr. 2012 09:00:11
The difference in time is 1 year(s), 0 month(s), 1 day(s), 0 hour(s) and 19 minute(s)
Time after: 1 mars 2013 09:19:11

Белешки од корисници

Нема белешки од корисници за оваа страница.
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.