
// ***************************************************************

//得到月全名稱列表

function getMonthNames()

{

global $locale_months ;

if ( ! empty ( $locale_months )){

$months = $locale_months ;

} else {

for ( $i = 1 ; $i < 13 ; $i ++ ){

$months [ $i ] = strftime ( ' %B ' , mktime ( 0 , 0 , 0 , $i , 1 , 2001
));

}

}

return ( $months );

}

// ****************************************************************

//得到月短名稱列表

function getMonthShortNames( $length = 3 )

{

global $locale_short_months ;

if ( ! empty ( $locale_short_months )){

$months = $locale_short_months ;

} else {

for ( $i = 1 ; $i < 13 ; $i ++ ){

$months [ $i ] = strftime ( ' %B ' , mktime ( 0 , 0 , 0 , $i , 1 , 2001 ));

$months [ $i ] = substr ( $months [ $i ] , 0 , $length );

}

}

return ( $months );

}

// *****************************************************************

//得到星期全名稱列表

function getWeekDays()

{

global $locale_weeks ;

if ( ! empty ( $locale_weeks )){

$weekdays = $locale_weeks ;

} else {

for ( $i = 0 ; $i < 7 ; $i ++ ){

$weekdays [ $i ] = strftime ( ' %A ' , mktime ( 0 , 0 , 0 , 1 , $i , 2001 ));

}

}

return ( $weekdays );

}

// ****************************************************************

//得到星期短名稱列表

function getShortWeekDays( $length = 3 )

{

global $locale_short_week ;

if ( ! empty ( $locale_short_week )){

$weekdays = $locale_short_week ;

} else {

for ( $i = 0 ; $i < 7 ; $i ++ ){

$weekdays [ $i ] = strftime ( ' %A ' , mktime ( 0 , 0 , 0 , 1 , $i , 2001 ));

$weekdays [ $i ] = substr ( $weekdays [ $i ] , 0 , $length
);

}

}

return ( $weekdays );

}

//
****************************************************************

//得到月全名稱

function getMonthFromFullName( $month )

{

$month = strtolower ( $month );

$months = Date_Calc :: getMonthNames();
while ( list ( $id , $name ) = each ( $months )){

if ( ereg ( $month , strtolower ( $name ))){

return ( $id );

}

}
return ( 0 );

}

// ****************************************************************

//得到月短名稱

function getMonthAbbrname( $month , $length = 3 )

{

$month = strtolower (
$month );

$months = Date_Calc :: getMonthShortNames();

while ( list ( $id , $name ) = each ( $months )){

if ( ereg ( $month , strtolower ( $name ))){

return ( $id );

}

}

return ( 0 );

} // end func getMonthAbbrname

//****************************************************************

//得到星期短名稱

function getWeekdayFullname( $day = "" , $month = "" , $year = "" )

{

if ( empty ( $year ))

$year = Date_Calc :: dateNow( " %Y " );

if
( empty ( $month ))

$month = Date_Calc :: dateNow( " %m " );

if ( empty ( $day ))

$day = Date_Calc :: dateNow( " %d " );

$weekday_names = Date_Calc :: getWeekDays();

$weekday = Date_Calc :: dayOfWeek( $day , $month , $year );

return $weekday_names [ $weekday ];

} // end func getWeekdayFullname


//****************************************************************

//得到星期短名稱

function getWeekdayAbbrname( $day = "" , $month = "" , $year = "" , $length = 3 )

{

if ( empty ( $year ))

$year = Date_Calc ::
dateNow( " %Y " );

if ( empty ( $month ))

$month = Date_Calc :: dateNow( " %m " );

if ( empty ( $day ))

$day = Date_Calc :: dateNow( " %d " );


$weekday_names = Date_Calc :: getShortWeekDays();

$weekday = Date_Calc :: dayOfWeek( $day , $month , $year );

return $weekday_names [ $weekday ];

} // end func getWeekdayAbbrname
