CakeFest 2024: The Official CakePHP Conference

IntlCalendar::getRepeatedWallTimeOption

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

IntlCalendar::getRepeatedWallTimeOptionObtener el comportamiento para tratar horas repetidas

Descripción

Estilo orientado a objetos

public IntlCalendar::getRepeatedWallTimeOption(): int

Estilo por procedimientos

intlcal_get_repeated_wall_time_option(IntlCalendar $cal): int

Obtiene la estrategia actual para tratar con horas repetidas siempre que el reloj se atrase durante las transiciones del final del horario de verano (DST). El valor predeterminado es IntlCalendar::WALLTIME_LAST.

Esta función requiere ICU 4.9 o posterior.

Parámetros

cal

El recurso IntlCalendar.

Valores devueltos

Una de las constantes IntlCalendar::WALLTIME_FIRST o IntlCalendar::WALLTIME_LAST.

Ejemplos

Ejemplo #1 IntlCalendar::getRepeatedWallTimeOption()

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

// El 27 de octubre a las 0200, el reloj se atrasa 1 hora y de GMT+01 a GMT+00
$cal = new IntlGregorianCalendar(2013, 9 /* October */, 27, 1, 30);

var_dump($cal->getRepeatedWalltimeOption()); // 0 WALLTIME_LAST

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

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

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

El resultado del ejemplo sería:

int(0)
string(42) "Sunday, October 27, 2013 at 1:30:00 AM GMT"
int(1)
string(43) "Sunday, October 27, 2013 at 12:30:00 AM GMT"

Ver también

add a note

User Contributed Notes

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