2 ) $theyear= $C - 4716; else $theyear= $C - 4715; return sprintf( "%04d%02d%02d", $theyear, $themonth, $theday); } function J2datetime( $thejul) { $Z= (int) ( $thejul + 0.5 ); $F= ( $thejul + 0.5 ) - $Z; if ( $Z < 2299161 ) $A= $Z; else { $alpha= (int) ( ( $Z - 1867216.25 ) / 36524.25 ); $A= $Z + 1 + $alpha - (int) ( $alpha / 4); } $B= $A + 1524; $C= (int) ( ( $B - 122.1 ) / 365.25 ); $D= (int) ( 365.25 * $C ); $E= (int) ( ( $B - $D ) / 30.6001 ); $theday= $B - $D - (int) (30.6001 * $E ) + $F; if ( $E < 14 ) $themonth= $E - 1; else $themonth= $E - 13; if ( $themonth > 2 ) $theyear= $C - 4716; else $theyear= $C - 4715; $thehour= ( $theday - (int) $theday ) * 24.0 ; $theminute= ( $thehour - (int) $thehour ) * 60.0 ; $thesecond= ( $theminute - (int) $theminute ) * 60.0 ; return sprintf( "%04d-%02d-%02d %02d:%02d:%04.2f", $theyear, $themonth, $theday, $thehour, $theminute, $thesecond); } function CRstartdate( $thecr) { return( J2date( cr2J( $thecr))); } function CRenddate( $thecr) { return( J2date( cr2J( $thecr+1)-1)); } ?>