Created
May 27, 2013 20:45
-
-
Save nguyenvanduocit/5658987 to your computer and use it in GitHub Desktop.
Tính chu kỳ sinh học
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function liveDay($birthDay) | |
{ | |
$timezone = +7; | |
$toDay = gmstrftime("%m/%d/%Y",time()+ 3600*($timezone+date("0"))); | |
$date_parts1=explode('/', $birthDay);//loai bo ki tu dac biet nhu '-' hoac '/' | |
$date_parts2=explode('/', $toDay); | |
$start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);//($thang,$ngay,$nam) | |
$end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]); | |
return $end_date - $start_date; | |
} | |
function nhipSinhHoc($birthDay) | |
{ | |
$pi2liveDay=2*M_PI*liveDay($birthDay); | |
$nhipSinhHoc['nangLuong'] = round((sin($pi2liveDay/23)+1)/2*100); | |
$nhipSinhHoc['tinhCam'] = round((sin($pi2liveDay/28)+1)/2*100); | |
$nhipSinhHoc['triTue'] = round((sin($pi2liveDay/33)+1)/2*100); | |
$nhipSinhHoc['trucGiac'] = round((sin($pi2liveDay/38)+1)/2*100); | |
$nhipSinhHoc['thamMy'] = round((sin($pi2liveDay/43)+1)/2*100); | |
$nhipSinhHoc['tamLinh'] = round((sin($pi2liveDay/53)+1)/2*100); | |
return $nhipSinhHoc; | |
} | |
function nhipSinhHocBy($birthDay,$type) | |
{ | |
$pi2liveDay=2*M_PI*liveDay($birthDay); | |
switch ($type) | |
{ | |
case 'nangLuong': | |
return round((sin($pi2liveDay/23)+1)/2*100); | |
case 'tinhCam': | |
return round((sin($pi2liveDay/28)+1)/2*100); | |
case 'triTue': | |
return round((sin($pi2liveDay/33)+1)/2*100); | |
case 'trucGiac': | |
return round((sin($pi2liveDay/28)+1)/2*100); | |
case 'thamMy': | |
return round((sin($pi2liveDay/43)+1)/2*100); | |
case 'tamLinh': | |
return round((sin($pi2liveDay/53)+1)/2*100); | |
default : | |
return round((sin($pi2liveDay/23)+1)/2*100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment