PHP 8.5.0 Alpha 2 available for testing

IntlCalendar::getSkippedWallTimeOption

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

IntlCalendar::getSkippedWallTimeOptionObtiene el comportamiento para la gestión de las horas murales omitidas

Descripción

Estilo orientado a objetos

public IntlCalendar::getSkippedWallTimeOption(): int

Estilo procedimental

intlcal_get_skipped_wall_time_option(IntlCalendar $calendar): int

Devuelve la estrategia actual para la gestión de las horas murales omitidas cuando el reloj se adelanta durante las transiciones de inicio de hora de verano. El valor por omisión es IntlCalendar::WALLTIME_LAST.

El calendario debe ser tolerante para que esta opción tenga efecto, de lo contrario intentar definir una hora inexistente provocará una error.

Esta función requiere ICU 4.9 o más reciente.

Parámetros

calendar

An IntlCalendar instance.

Ejemplos

Ejemplo #1 IntlCalendar::getSkippedWallTimeOption()

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

//El 31 de Marzo a las 0100, el reloj avanzará una hora de GMT+00 a GMT+01
$cal = new IntlGregorianCalendar(2013, 2 /* March */, 31, 1, 30);

var_dump(
$cal->isLenient(), // true
$cal->getSkippedWalltimeOption() // 0 WALLTIME_LAST
);

$formatter = IntlDateFormatter::create(
NULL,
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'UTC'
);
var_dump($formatter->format($cal->getTime() / 1000));

$cal->setSkippedWallTimeOption(IntlCalendar::WALLTIME_FIRST);
var_dump($cal->getSkippedWalltimeOption()); // 1 WALLTIME_FIRST
$cal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 1);

var_dump($formatter->format($cal->getTime() / 1000));

$cal->setSkippedWallTimeOption(IntlCalendar::WALLTIME_NEXT_VALID);
var_dump($cal->getSkippedWalltimeOption()); // 2 WALLTIME_NEXT_VALID
$cal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 1);

var_dump($formatter->format($cal->getTime() / 1000));

El ejemplo anterior mostrará :

bool(true)
int(0)
string(40) "Sunday, March 31, 2013 at 1:30:00 AM GMT"
int(1)
string(41) "Sunday, March 31, 2013 at 12:30:00 AM GMT"
int(2)
string(40) "Sunday, March 31, 2013 at 1:00:00 AM GMT"

Ver también

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top