Posted By

reiko on 08/26/07


Tagged

AGE birth


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jamesming
seloh77


Calculate age from date of birth to today


 / Published in: PHP
 

URL: http://itpro.nikkeibp.co.jp/article/Watcher/20070822/280097/

生年月日から年齢を計算する簡単な計算式

(今日の日付-誕生日)/10000の小数点以下切捨て。

  1. $birthday = 19830112;
  2. $today = 20070827;
  3.  
  4. $age = (int)(($today - $birthday)/10000);

Report this snippet  

You need to login to post a comment.