MANUAL DE PHP

(y algo mas)windsurf pozo izquierdo
Google
search for in the  
ELMARRAJO.COM mysql bulma desarrollo web linux fedora html ayuda

windsurf mercedes camper

X. Funciones de calendario

Introducción

La extensión calendar pone a disposición una serie de funciones para simplificar la conversión entre los distintos formatos de calendario. El intermediario ó estándar en que se basa es la Cuenta de Días Juliana. La Cuenta de Días Juliana es una cuenta que comienza mucho antes que lo que mucha gente podría necesitar contar (como alrededor del 4000 AC). Para convertir entre sistemas de calendario, primero deberá convertir a la Cuenta de Días Juliana y luego al sistema de su elección. ¡La Cuenta de Días es muy diferente del Calendario Juliano! Para más información sobre la Cuenta de Días Juliana visitar http://www.hermetic.ch/cal_stud/jdn.htm. Para más información sobre sistemas de calendario, visitar http://www.boogle.com/info/cal-overview.html. En estas instrucciones se han incluído extractos entrecomillados de dicha página.

Instalación

Para tener trabajando estas funciones, tiene que compilar PHP con --enable-calendar.

La versión para Windows de PHP tiene soporte nativo para esta extensión. No se necesita cargar ninguna extensión adicional para usar estas funciones.

Configuración en tiempo de ejecución

Esta extensión no tiene directivas de configuración en php.ini.

Tipos de recursos

Esta extensión no tiene ningún tipo de recurso definido.

Constantes predefinidas

Estas constantes están definidas por esta extensión y estarán disponibles solamente cuando la extensión ha sido o bien compilada dentro de PHP o grabada dinámicamente en tiempo de ejecución.

CAL_GREGORIAN (entero)

CAL_JULIAN (entero)

CAL_JEWISH (entero)

CAL_FRENCH (entero)

CAL_NUM_CALS (entero)

CAL_DOW_DAYNO (entero)

CAL_DOW_SHORT (entero)

CAL_DOW_LONG (entero)

CAL_MONTH_GREGORIAN_SHORT (entero)

CAL_MONTH_GREGORIAN_LONG (entero)

CAL_MONTH_JULIAN_SHORT (entero)

CAL_MONTH_JULIAN_LONG (entero)

CAL_MONTH_JEWISH (entero)

CAL_MONTH_FRENCH (entero)

Las siguientes constantes se pueden utilizar desde PHP 4.3.0 :

CAL_EASTER_DEFAULT (entero)

CAL_EASTER_ROMAN (entero)

CAL_EASTER_ALWAYS_GREGORIAN (entero)

CAL_EASTER_ALWAYS_JULIAN (entero)

Estas constantes están disponibles a partir de PHP 5.0.0 :

CAL_JEWISH_ADD_ALAFIM_GERESH (entero)

CAL_JEWISH_ADD_ALAFIM (entero)

CAL_JEWISH_ADD_GERESHAYIM (entero)

Tabla de contenidos
cal_days_in_month -- Devuelve el número de dias en un mes para un determinado año y calendario
cal_from_jd -- Convierte de Cuenta de Días Juliana a un calendario soportado.
cal_info -- Devuelve información sobre un calendario en particular.
cal_to_jd -- Convierte un calendario soportado a Cuenta de Días Juliana.
easter_date -- devuelve la marca de tiempo UNIX para la medianoche de Pascua de un año dado
easter_days -- Obtiene el número de días tras el 21 de marzo en que cae la Pascua en un año dado
FrenchToJD -- Convierte del Calendario Republicano Francés a la Cuenta de Días Juliana
GregorianToJD -- Convierte de fecha Gregoriana a la Cuenta de Días Juliana
JDDayOfWeek -- Devuelve el día de la semana
JDMonthName -- Devuelve el nombre de un mes
JDToFrench -- Convierte de Cuenta de Días al Calendario Republicano Francés
JDToGregorian -- Convierte de Cuenta de Días a fecha Gregoriana
jdtojewish -- Convierte de cuenta de días juliana a calendario judío
JDToJulian -- Convierte de Cuenta de Días Juliana a Calendario Juliano
jdtounix -- Convierte un dia Juliano a UNIX timestamp
JewishToJD -- Convierte del Calendario Judío a la Cuenta de Días Juliana
JulianToJD -- Convierte de Calendario Juliano a Cuenta de Días Juliana
unixtojd -- Convierte de UNIX timestamp a dia Juliano


add a note add a note User Contributed Notes
Funciones de calendario
fRay Ferguson
21-Apr-2006 07:32
The following is a light reimplimentation of some of these functions wich can be used in an include file to work around the lack of --with-calendar in php implimentations.

<?php

/* IMPLEMENTS SUBSET OF PHP CALENDAR FUNCTIONS ON SYSTEMS COMPILED W/O --enable-calendar */

if (!function_exists('cal_days_in_month')){
       function
cal_days_in_month($a_null, $a_month, $a_year) {
               return
date('t', mktime(0, 0, 0, $a_month+1, 0, $a_year));
       }
}

if (!
function_exists('cal_to_jd')){
       function
cal_to_jd($a_null, $a_month, $a_day, $a_year){
               if (
$a_month <= 2 ){
                    
$a_month = $a_month + 12 ;
                    
$a_year = $a_year - 1 ;
               }
              
$A = intval($a_year/100);
              
$B = intval($A/4) ;
              
$C = 2-$A+$B ;
              
$E = intval(365.25*($a_year+4716)) ;
              
$F = intval(30.6001*($a_month+1));
               return
intval($C+$a_day+$E+$F-1524) ;
       }
}

if (!
function_exists('get_jd_dmy')) {
   function
get_jd_dmy($a_jd){
    
$W = intval(($a_jd - 1867216.25)/36524.25) ;
    
$X = intval($W/4) ;
    
$A = $a_jd+1+$W-$X ;
    
$B = $A+1524 ;
    
$C = intval(($B-122.1)/365.25) ;
    
$D = intval(365.25*$C) ;
    
$E = intval(($B-$D)/30.6001) ;
    
$F = intval(30.6001*$E) ;
    
$a_day = $B-$D-$F ;
     if (
$E > 13 ) {
      
$a_month=$E-13 ;
      
$a_year = $C-4715 ;
     } else {
      
$a_month=$E-1 ;
      
$a_year=$C-4716 ;
     }
     return array(
$a_month, $a_day, $a_year) ;
   }
}

if (!
function_exists('jdmonthname')) {
       function
jdmonthname($a_jd,$a_mode){
              
$tmp = get_jd_dmy($a_jd) ;
              
$a_time = "$tmp[0]/$tmp[1]/$tmp[2]" ;
               switch(
$a_mode) {
                       case
0:
                               return
strftime("%b",strtotime("$a_time")) ;
                       case
1:
                               return
strftime("%B",strtotime("$a_time")) ;
               }
       }
}

if (!
function_exists('jddayofweek')) {
       function
jddayofweek($a_jd,$a_mode){
              
$tmp = get_jd_dmy($a_jd) ;
              
$a_time = "$tmp[0]/$tmp[1]/$tmp[2]" ;
               switch(
$a_mode) {
                       case
1:
                               return
strftime("%A",strtotime("$a_time")) ;
                       case
2:
                               return
strftime("%a",strtotime("$a_time")) ;
                       default:
                               return
strftime("%w",strtotime("$a_time")) ;
               }
       }
}

?>
amichauer at gmx dot de
27-Jun-2005 09:46
<?php

class HijriCalendar
{
   function
monthName($i) // $i = 1..12
  
{
       static
$month  = array(
          
"Möxärräm", "Safar", "Rabig-äl-Äwwäl", "Rabig-äl-Axír",
          
"Cömäd-äl-Äwwäl", "Cömäd-äl-Axír", "Racäb", "Þäðbän",
          
"Ramazan", "Þäwäl", "Zö-äl-Qäðdä", "Zö-äl-Xiccä"
      
);
       return
$month[$i-1];
   }

   function
GregorianToHijri($time = null)
   {
       if (
$time === null) $time = time();
      
$m = date('m', $time);
      
$d = date('d', $time);
      
$y = date('Y', $time);

       return
HijriCalendar::JDToHijri(
          
cal_to_jd(CAL_GREGORIAN, $m, $d, $y));
   }

   function
HijriToGregorian($m, $d, $y)
   {
       return
jd_to_cal(CAL_GREGORIAN,
          
HijriCalendar::HijriToJD($m, $d, $y));
   }

  
# Julian Day Count To Hijri
  
function JDToHijri($jd)
   {
      
$jd = $jd - 1948440 + 10632;
      
$n  = (int)(($jd - 1) / 10631);
      
$jd = $jd - 10631 * $n + 354;
      
$j  = ((int)((10985 - $jd) / 5316)) *
           ((int)(
50 * $jd / 17719)) +
           ((int)(
$jd / 5670)) *
           ((int)(
43 * $jd / 15238));
      
$jd = $jd - ((int)((30 - $j) / 15)) *
           ((int)((
17719 * $j) / 50)) -
           ((int)(
$j / 16)) *
           ((int)((
15238 * $j) / 43)) + 29;
      
$m  = (int)(24 * $jd / 709);
      
$d  = $jd - (int)(709 * $m / 24);
      
$y  = 30*$n + $j - 30;

       return array(
$m, $d, $y);
   }

  
# Hijri To Julian Day Count
  
function HijriToJD($m, $d, $y)
   {
       return (int)((
11 * $y + 3) / 30) +
          
354 * $y + 30 * $m -
           (int)((
$m - 1) / 2) + $d + 1948440 - 385;
   }
};

$hijri = HijriCalendar::GregorianToHijri( time() );
echo
$hijri[1].'. '.HijriCalendar::monthName($hijri[0]).' '.$hijri[2];

?>
pouya
03-Apr-2004 10:39
There is an implementation of the Persian calendar at www.farsiweb.info.
jthome at fcgov dot com
02-Oct-2003 11:38
Had a similar problem as curlee, except I needed to create a JDE_ERP date.  [format is CYYDDD]

<?php

function jde_date_create($month, $day, $year){
  
/*
   *  NOTE: $month and $day CANNOT have leading zeroes,
   *        $year must be'YYYY' format
   */
  
$jde_year_prefix = substr($year, 0, 1) - 1;
  
$jde_year_suffix = substr($year, -2);
  
  
//note that valid years for mktime are 1902-2037
  
$timestamp = mktime(0,0,0,$month, $day, $year);
  
$baseline_timestamp = mktime(0,0,0,1,0,$year);
  
  
$day_count = round(($timestamp - $baseline_timestamp)/86400);
  
$day_count_padded = str_pad($day_count,3,"0",STR_PAD_LEFT);

   return (
$jde_year_prefix . $jde_year_suffix . $day_count_padded);
  
}

echo
jde_date_create(6,25,2000);// will return '103176'

?>

--
Jim
curlee at mindspring dot com
29-Aug-2003 08:55
I solved a problem with Julian dates that are used in the JD Edwards ERP package (running on AS/400).  The Julian format for this system is as follows:  CYYDDD

Where C is 0 for 1900 and 1 for 2000
DDD is the day of the year count

I used the mktime built-in php function to convert dates to the normal DD/MM/YYYY format.  This function will convert dates that are between 1970 and 2038 (limitation of unix timestamps and the mktime function)

The $jde_date var needs to be a 6 len STRING.... if you use a numeric var type it will drop the leading 0 for any date that represents 1900.... this will botch the substr functions and thus make the whole thing wrong. 

function jde_date_conv($jde_date)
{

$ct = substr($jde_date,0,1);
$yr = substr($jde_date,1,2);
$dy = substr($jde_date,3,3);

if($ct == 0) $yr_pfx = 19;
if($ct == 1) $yr_pfx = 20;

$tlt_yr = $yr_pfx.$yr;

$base_time = mktime(0,0,0,1,0,$tlt_yr);

$unix_time = ($dy * 86400) + $base_time;

return date("m/d/Y" , $unix_time);
}
carlj at vibez dot ca
17-Jun-2003 12:28
Why not do something like this, to find the number of days in a month?

$monthNum = date("n"); // or any value from 1-12
$year        = date("Y"); // or any value >= 1
$numDays  = date("t",mktime(0,0,0,$monthNum,1,$year))

This will tell you if there is 28-31 days in a month
dy64 at dy64 dot de
12-Nov-2002 06:18
Best performance:
/*
 * Find the number of days in a month
 * Year is between 1 and 32767 inclusive
 * Month is between 1 and 12 inclusive
 */
function DayInMonth($month, $year) {
   var $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
   if ($month != 2) return $daysInMonth[$month - 1];
   return (checkdate($month, 29, $year)) ? 29 : 28;
}
kmcm at bigfoot dot com
20-Jan-2002 06:42
if, like me, you don't have a PHP build that includes the cal functions, you may want to use this function for sorting out leap year.

function days_in_feb($year){

   //$year must be YYYY
   //[gregorian] leap year math :
  
   if ($year < 0) $year++;
   $year += 4800;

   if ( ($year % 4) == 0) {
       if (($year % 100) == 0) {
           if (($year % 400) == 0) {
               return(29);
           } else {
               return(28);
           }
       } else {
           return(29);
       }
   } else {
       return(28);
   }
}

of course the next leap year isn't until the end of the century but this makes for timeless code I guess ...or if you are using 2000 in your dates or are going far back in time, etc, it is necessary.
mikebabcock at pobox dot com
17-Jul-2000 09:20
There are two world calculations for the date of Easter.  The Easter date function should account for this; one used (generally) by the Western world and one (generally) used by the Eastern (the official date used by the East Orthodox Church).
ssharma at odc dot net
31-Jan-2000 03:36
If you're interested in dates/calendars, check out the MCAL stuff.
http://www.php.net/manual/http://indices.com.es/ref.mcal.html3

Citas célebres

Cualquier traje es un disfraz, ¿o no? Excepto nuestra piel natural, claro.

George Bernard Shaw
Dramaturgo inglés
(1856-1950)
Citas en tu mail
©Contenidos Gratis

Ilusiones Opticas
ilusion_optica_052.jpg
Contenidos Web

Chiste de... Varios
Santos

- ¿Cuál es el santo más cuadrado?

- San Marcos.

- ¿Cuál es el santo de los bailarines?

- San Bailón.

- ¿Y el más deportista?

- San Gimnasio de Loyola.

- ¿Y el de los futbolistas?

- San Cadilla.

- ¿Y el santo más comido?

- San Güichito.
Chistes en tu mail
©ContenidosGratis

Humor Gráfico
humor_grafico_018.jpg
Contenidos Web

Inicio | Acción | Estrategia | Palabras | Puzzles | Solitarios | Foro Trucos
Cake ManiaCake Mania
Jugadores: 6835
Categoría del juego: Acción
Objetivo del juego: Ayuda a Jill a recuperar la pastelería de su abuela llevando su propia pastelería; consigue clientes y gana dinero.
Rainbow WebRainbow Web
Jugadores: 2199
Categoría del juego: Puzzles
Objetivo del juego: Rompe un pegajoso hechizo y salva un reino de fantasía en Rainbow Web. Tendrás toneladas de diversión mientras juegas a este mágico desafío para la mente.
Mahjongg FortunaMahjongg Fortuna
Jugadores: 12462
Categoría del juego: Solitarios
Objetivo del juego: Velocidad y habilidad mental son las armas más importantes en esta versión de un antiguo juego asiático. Despeja el tablero lo antes posible haciendo clic en las fichas iguales y gánate la fama eterna de la puntuación más alta.
Chainz 2Chainz 2
Jugadores: 6955
Categoría del juego: Puzzles
Objetivo del juego: Entra en el mundo de las combinaciones con Chainz 2: Relinked, emocionante secuela del exitazo del año pasado, Chainz. Gira eslabones y crea combinaciones de 3 ó más.
DeliciousDelicious
Jugadores: 4405
Categoría del juego: Acción
Objetivo del juego: ¿Eres un as de la multitarea? ¿Quieres que tus clientes estén contentos? ¡Pues Delicious es tu juego! Sacia el apetito de los clientes y tenlos contentos; ¡no te arriesgues!
BookwormBookworm
Jugadores: 4568
Categoría del juego: Palabras
Objetivo del juego: Junta las letras para formar palabras. ¡Las palabras más largas valen más puntos!
ZumaZuma
Jugadores: 4976
Categoría del juego: Acción
Objetivo del juego: Controla el ídolo de la rana de piedra de los antiguos Zuma en este intrigante enigma de acción. ¡Dispara bolas para formar conjuntos de tres, pero si dejas que lleguen a la calavera dorada morirás!
Jewel of AtlantisJewel of Atlantis
Jugadores: 3798
Categoría del juego: Puzzles
Objetivo del juego: Descubre la ciudad hundida de la Atlántida y busca valiosos tesoros. Viaja más allá de las profundidades del mar y vive trepidantes aventuras en Jewel of Atlantis.
Jewel QuestJewel Quest
Jugadores: 3727
Categoría del juego: Puzzles
Objetivo del juego: Convierte la arena de la antigua selva en oro tan rápido como puedas juntando grupos de 3 elementos. ¡Los grupos más grandes valen más puntos!
Bejeweled 2Bejeweled 2
Jugadores: 3659
Categoría del juego: Puzzles
Objetivo del juego: Con cuatro modos de juego únicos y fascinantes, nuevas piezas de juego explosivas e imponentes fondos planetarios, Bejeweled 2 es mucho más adictivo que nunca.
Contenidos gratis en tu webSiguiente >>

Fotos divertidas
fotos_increibles_0015.jpg
Contenidos Web
microrobots avion deportes riesgo recetas cocina canaria juegos online gratis moto motociclismo horoscopos naranjas valencianas surf canarias montañismo ciudades turismo postales gratis library Horoscopos Diarios Windsurf Canarias
fregadero microondas placa electrica bañopreparar camper pantalla plananevera compresor electricacamper fiat ducato camper baño quimicomampara enrollable bañocamper aire climatizadofurgoneta surf windsurffurgoneta surf windsurftelevisor furgonetas camperfurgonetas camper cama

Sudoku del día
Nivel de dificultad: Fácil



Cómo jugar:
El juego consiste en colocar los números del 1 al nueve de tal forma que no se repita el mismo número en la columna, fila y caja (bloques 3x3 enmarcados).

©Contenidos Gratis | Sudoku en tu mail

Warning: array_rand(): First argument has to be an array in /var/www/html/contenidos/efemerides.php on line 14
Sucedió el...

31 de agosto de

Efemérides en tu mail
©Contenidos Gratis
windsurf canarias youtube porno canarias baleares valencia madrid