/**

* 根据时间戳计算星座

* @param $time

* @return mixed

*/

function get_constellation($time)

{

$y   = date("Y").'-';

$his = ' 00:00:00';

$birth_month = date("m", $time);

$birth_date  = date("d", $time);

$userTime = strtotime($y.$birth_month.'-'.$birth_date.$his);

$januaryS   = strtotime($y.'01-20'.$his);

$januaryE   = strtotime($y.'02-18'.$his);

$februaryS  = strtotime($y.'02-19'.$his);

$februaryE  = strtotime($y.'03-20'.$his);

$marchS     = strtotime($y.'03-21'.$his);

$marchE     = strtotime($y.'04-19'.$his);

$aprilS     = strtotime($y.'04-20'.$his);

$aprilE     = strtotime($y.'05-20'.$his);

$mayS       = strtotime($y.'05-21'.$his);

$mayE       = strtotime($y.'06-21'.$his);

$juneS      = strtotime($y.'06-22'.$his);

$juneE      = strtotime($y.'07-22'.$his);

$julyS      = strtotime($y.'07-23'.$his);

$julyE      = strtotime($y.'08-22'.$his);

$augustS    = strtotime($y.'08-23'.$his);

$augustE    = strtotime($y.'09-22'.$his);

$septemberS = strtotime($y.'09-23'.$his);

$septemberE = strtotime($y.'10-23'.$his);

$octoberS   = strtotime($y.'10-24'.$his);

$octoberE   = strtotime($y.'11-22'.$his);

$novemberS  = strtotime($y.'11-23'.$his);

$novemberE  = strtotime($y.'12-21'.$his);

if($userTime >= $januaryS && $userTime <= $januaryE){

$constellation = '水瓶座';

}elseif($userTime >= $februaryS && $userTime <= $februaryE){

$constellation = '双鱼座';

}elseif($userTime >= $marchS && $userTime <= $marchE){

$constellation = '白羊座';

}elseif($userTime >= $aprilS && $userTime <= $aprilE){

$constellation = '金牛座';

}elseif($userTime >= $mayS && $userTime <= $mayE){

$constellation = '双子座';

}elseif($userTime >= $juneS && $userTime <= $juneE){

$constellation = '巨蟹座';

}elseif($userTime >= $julyS && $userTime <= $julyE){

$constellation = '狮子座';

}elseif($userTime >= $augustS && $userTime <= $augustE){

$constellation = '处女座';

}elseif($userTime >= $septemberS && $userTime <= $septemberE){

$constellation = '天秤座';

}elseif($userTime >= $octoberS && $userTime <= $octoberE){

$constellation = '天蝎座';

}elseif($userTime >= $novemberS && $userTime <= $novemberE){

$constellation = '射手座';

}else{

$constellation = '摩羯座';

}

return $constellation;

}

php 月份查询生日_PHP----------php根据生日(时间戳)计算星座相关推荐

  1. php 月份查询生日_PHP 实现通过生日计算年龄方法

    PHP的特性包括: 1. PHP 独特的语法混合了 C.Java.Perl 以及 PHP 自创新的语法. 2. PHP可以比CGI或者Perl更快速的执行动态网页--动态页面方面,与其他的编程语言相比 ...

  2. php 月份查询生日_php 根据生日计算星座和生肖程序

    魔羯座(12/22 – 1/19).水瓶座(1/20 – 2/18).双鱼座(2/19 – 3/20).牡羊座(3/21 – 4/20). 金牛座(4/21 – 5/20).双子座(5/21 – 6/ ...

  3. [MySQL]--gt;查询5天之内过生日的同事中的闰年2月29日问题的解决过程

    前言: 上次写了查询5天之内过生日的同事中的跨年问题的解决过程,网址为:http://blog.csdn.net/mchdba/article/details/38952033 ,当中漏了一个闰年2月 ...

  4. js月份的计算公式_JS根据生日月份和日期计算星座的简单实现方法

    本文实例讲述了JS根据生日月份和日期计算星座的简单实现方法.分享给大家供大家参考,具体如下: 看到了别人写的一个计算星座的js,冗长的有点儿看不过去,就自己写个了. 我想,这个函数应该足够精简了:) ...

  5. php根据日期判断星座if函数,js 日期计算星座 根据生日的月份和日期,一行代码计算星座的js小函数(转)...

    本文最后更新于2019-07-01,已超过 1年没有更新,如果文章内容.图片或者下载资源失效,请留言反馈,我会及时处理,谢谢! 温馨提示:本文共2388个字,读完预计6分钟. 摘要: 根据生日的月份和 ...

  6. AndroidStudio输入生日计算星座

    第一步:在主界面写两个startactivity,一个用于接收第二个页面传递过来的数据:另一个用于发送用户输入的数值 public class MainActivity extends AppComp ...

  7. iOS 生日计算星座

    /*** 根据生日计算星座** @param month 月份* @param day 日期** @return 星座名称*/ +(NSString *)calculateConstellationW ...

  8. 查询过去一个月有付款mysql_MySQL_mysql 月份查询该月有付款的数据,ktime 开始时间串 dtime 到期时间 - phpStudy...

    mysql 月份查询该月有付款的数据 ktime 开始时间串 dtime 到期时间串 jmonth 付费间隔月份数 可选(1,3,6,12) 需要 按月查询数据 比如说 ktime=122840640 ...

  9. js 根据公历日期 算出农历_给孩子过农历生日,还是阳历生日?家长不要盲从,看看这些再决定...

    生日的实质是一个纪念日,是庆祝每个孩子来到世界上的一天,也是母亲受苦的一天.过生日也可使孩子更懂得感恩母亲,所以,无论是对于孩子或父母来说,都有非常重要的意义. 对于生活在七八十年代的父母来说,通常是 ...

  10. mysql根据月份查询订单销售额

    mysql根据月份查询订单销售额 这样的样式,查出 这样的效果 代码如下:下面是连表查询的 select year(o.order_create) yy,month(o.order_create) m ...

最新文章

  1. 如何给Docker镜像瘦身?
  2. 查表法的CRC8和CRC16程序
  3. java课堂疑问解答与思考2
  4. 5分钟用Spring4 搭建一个REST WebService(转)
  5. was java sdk_关于WAS9单独安装SDK的问题?
  6. c语言字符常量和字符串常量_C语言中的字符常量
  7. PHP-递归扫描目录和删除目录
  8. 服务器群集:Windows 2000 和 Windows Server 2003 网络配置的最佳做法(转自Technet)
  9. TensorFlow学习笔记01:图
  10. js基础知识汇总08
  11. prometheus linux下载_Prometheus笔记
  12. windows 游戏编程 一windows 编程
  13. 计算机黑屏闪光标,电脑开机黑屏只有光标在闪的解决方法
  14. hc-05 android 蓝牙连接,实用,教你简单使用HC05蓝牙模块及如何配对?
  15. ORACLE RAC 11.2.0.4 一节点出现Suspending MMON slave action kewrmrfsa_ for 82800 seconds
  16. 北漂IT男返乡2年的三线楼市观察(宜昌夷陵篇)-原创
  17. 讲清楚之 javascript原形
  18. 阿里云认证有什么用?考试费用高不高?
  19. Python爬虫与信息提取(八)将新浪热搜排名导入数据库
  20. 文本框直接粘贴添加图片构想

热门文章

  1. css3弧形跑道效果_【Tableau 图表】你是不是真的需要一个跑道图呢?
  2. HALCON 21.11:深度学习笔记(2)
  3. All xxx functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  4. Python+OpenCV:图像Harris角点检测(Harris Corner Detection)
  5. 纺织名词术语(针织品部分)---疵点
  6. 7、【转载】python yield generator 详解
  7. MySQL百万级高并发网站优化
  8. 深入理解redis复制原理
  9. MVC4 数据验证、特性、自动属性总结
  10. WPF系列:GridView列绑定控件(一)