zoukankan      html  css  js  c++  java
  • 生日计算方法

    php:
    1.首先数据库里面查询出一个数组来
    2.$users =    D('baoming_user')->where($maps)->select();
            foreach($users as $key=>$val){
                $date = explode("-",date("Y-m-d",$val['birthday']));//先把年月日拆分开
                $dateb = date("Y")."-".$date[1]."-".$date[2];//再把把年月日按当年合并起来
                $num = (strtotime($dateb)-strtotime(date("Y-m-d")))/86400;//然后相减除以86400得到天数
                if($num<7){//重新定义一个新的 数组。
                    $user[$key]['id']             =$val['id'];
                    $user[$key]['name']         =$val['baoming_name'];
                    $user[$key]['birthday']     =date('Y-m-d',$val['birthday']);
                    $user[$key]['count_down']     =$num;    //    倒计时天数
                    $user[$key]['mobile']         =$val['mobile'];  
                }
            }
    html:
    <h6>生日提醒</h6>
            <div class="content">
                    <table>
                        <tr>
                            <th>学员姓名</th>
                            <th>学员生日</th>
                            <th>生日倒计时</th>
                            <th>手机号</th>
                        </tr>
                        <volist name="user" id="us" offset="1" length='4'>
                        <tr>
                            <td>{$us.name}</td>
                            <td>{$us.birthday}</td>
                            <td>还有<span style="color:red; font-size:18px"> &nbsp;{$us.count_down} &nbsp;</span>天生日</td>
                            <td>{$us.mobile}</td>
                        </tr>
                        </volist>
                    </table>
             <div class="bk20 hr"></div>     
           
            </div>
    效果:

  • 相关阅读:
    1.RabbitMQ简介
    有这样一个需求 element +vue 实现显示的table 的表头添加一个添加图标, 并绑定一个点击事件,我查了好多资料, 终于找到table 表头的一个事件 :render-header 可以实现。
    原生的html js 做的文件上上传
    elment + vue 文件上传
    FastJson对于JSON格式字符串、JSON对象及JavaBean之间的相互转换
    mysql 数据库迁移 sql server (沃尔玛)
    quartz 浅谈 Scheduler
    quartz CronTrigger的cron表达式 详解:
    Linux中的一些常用命令
    类图中常用的六种关系
  • 原文地址:https://www.cnblogs.com/Jerry-blog/p/5010248.html
Copyright © 2011-2022 走看看