1 (edytowany przez KOGUT123 2016-11-14 20:16:02)

Temat: easter_date

Witam dlaczego ta funkcja nie działa "easter_date"

$easter = date ( 'm-d' , easter_date ( $year ));

wywala błąd "Call to undefined function easter_date() in"

zainstalowane mam zoneinfo-core zoneinfo-europe

2

Odp: easter_date

php?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: easter_date

tak

4

Odp: easter_date

W openwrt? Wg manuala bazuje to na bibliotece systemowej (libc), w openwrt masz uproszczony uclibc...

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: easter_date

Wypróbuj może tego.
Mnie liczy dobrze.

function easter_dates ( $Year ) {

/*
G is the Golden Number-1
H is 23-Epact (modulo 30)
I is the number of days from 21 March to the Paschal full moon
J is the weekday for the Paschal full moon (0=Sunday,
1=Monday, etc.)
L is the number of days from 21 March to the Sunday on or before
the Paschal full moon (a number between -6 and 28)
*/


$G = $Year % 19 ;
$C = (int)( $Year / 100 );
$H = (int)( $C - (int)( $C / 4 ) - (int)(( 8 * $C + 13 ) / 25 ) + 19 * $G + 15 ) % 30 ;
$I = (int) $H - (int)( $H / 28 )*( 1 - (int)( $H / 28 )*(int)( 29 / ( $H + 1 ))*((int)( 21 - $G ) / 11 ));
$J = ( $Year + (int)( $Year / 4 ) + $I + 2 - $C + (int)( $C / 4 )) % 7 ;
$L = $I - $J ;
$m = 3 + (int)(( $L + 40 ) / 44 );
$d = $L + 28 - 31 * ((int)( $m / 4 ));
$y = $Year ;
$E = mktime ( 0 , 0 , 0 , $m , $d , $y );

return $E ;

}

6

Odp: easter_date

mam takie coś:

function easter_date ( $year ) {
    $G = $Year % 19 ;//G is the Golden Number-1
    $C = (int)( $Year / 100 );
    $H = (int)( $C - (int)( $C / 4 ) - (int)(( 8 * $C + 13 ) / 25 ) + 19 * $G + 15 ) % 30 ;//H is 23-Epact (modulo 30)
    $I = (int) $H - (int)( $H / 28 )*( 1 - (int)( $H / 28 )*(int)( 29 / ( $H + 1 ))*((int)( 21 - $G ) / 11 ));//I is the number of days from 21 March to the Paschal full moon
    $J = ( $Year + (int)( $Year / 4 ) + $I + 2 - $C + (int)( $C / 4 )) % 7 ;//J is the weekday for the Paschal full moon (0=Sunday,1=Monday, etc.)
    $L = $I - $J ;//L is the number of days from 21 March to the Sunday on or before the Paschal full moon (a number between -6 and 28)
    $m = 3 + (int)(( $L + 40 ) / 44 );
    $d = $L + 28 - 31 * ((int)( $m / 4 ));
    $y = $Year ;
    $E = mktime ( 0 , 0 , 0 , $m , $d , $y );
    return $E ;
}

function WorkingDay($date) {
    $time = strtotime($date);
    $dayOfWeek = (int)date('w',$time);
    $year = (int)date('Y',$time);

    if( $dayOfWeek==6 || $dayOfWeek==0 ) {//sprawdzenie czy to nie weekend
    return false;
    }

    $holiday=array('01-01', '01-06','05-01','05-03','08-15','11-01','11-11','12-25','12-26');//lista swiat stalych

    $easter = date ( 'm-d' , easter_date ( $year ));//dodanie listy swiat ruchomych wialkanoc
    $easterSec = date('m-d', strtotime('+1 day', strtotime( $year . '-' . $easter) ));//poniedzialek wielkanocny
    $cc = date('m-d', strtotime('+60 days', strtotime( $year . '-' . $easter) ));//boze cialo
    $p = date('m-d', strtotime('+49 days', strtotime( $year . '-' . $easter) ));//Zesłanie Ducha Świętego

    $holiday[] = $easter;
    $holiday[] = $easterSec;
    $holiday[] = $cc;
    $holiday[] = $p;

    $md = date('m-d',strtotime($date));
    if(in_array($md, $holiday)) return false;
    return true;
   
}    //echo WorkingDay(date("Y-m-d"));

//echo WorkingDay("2016-3-28");
echo date ( 'm-d' , easter_date ( 2017 ));  //tu zle liczy

co jest nie tak

7

Odp: easter_date

Wyliczyłem moją funkcją i wyszło  04-16
Dla Twojej wyszło  04-09.

8

Odp: easter_date

no właśnie w tym jest błąd wywołanie twojej funkcji daje mi błąd
napisz jak ty liczysz bo w  twojej funkcji nic nie zmieniałem (logicznego)

9

Odp: easter_date

Może to, że moja nazwa funkcji  to easter_dates ?

10

Odp: easter_date

Napisz jak ją wywołujesz u siebie ?

11

Odp: easter_date

echo date ( 'm-d' , easter_dates ( 2017 ));

12

Odp: easter_date

ok dzięki za pomoc i za kod

powinni być         function easter_date ( $Year ) {
a było u mnie       function easter_date ( $year ) {
i tu błąd