dongquanjie9328 2011-11-09 17:20
浏览 44
已采纳

用php修改日期

Basically that is the function that I use to extract the date from the php and modify it:

      function getAge()
  {
         $result= mysql_query("SELECT date_of_birth 
                        FROM controlpanel 
                        WHERE user_id=".$this->userID) or die(mysql_error());
         $year="";
          if($row=mysql_fetch_array($result))
          {
               $row['date_of_birth'];
          }


  }

$row['date_of_birth']; I want to get the year from that row, and check if it is 0000..if it is I want to return return "Not given";.. if it isnt, I want to compare the full date d-m-y to todays date.. in order to get the persons birth date..however, I am not sure what date functions to use..

  • 写回答

4条回答 默认 最新

  • dpbyr64224 2011-11-09 17:25
    关注
    if( substr($row['date_of_birth'],0,4) == "0000") echo "Not given";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 socket通信实现多人聊天室疑惑
  • ¥15 DEV-C++编译缺失
  • ¥33 找熟练码农写段Pyhthon程序
  • ¥100 怎么让数据库字段自动更新
  • ¥15 antv g6 力导向图布局
  • ¥15 quartz框架,No record found for selection of Trigger with key
  • ¥15 锅炉建模+优化算法,遗传算法优化锅炉燃烧模型,ls-svm会搞,后面的智能算法不会
  • ¥20 MATLAB多目标优化问题求解
  • ¥15 windows2003服务器按你VPN教程设置后,本地win10如何连接?
  • ¥15 求一阶微分方程的幂级数