|
 |
|
คำนวณวันเดือนปีเกิด หวัดดีครับผมยากได้วิธีคำนวณวันเกิดในแท็กบ๊อก |
|
 |
|
|
 |
 |
|
อยากได้ก็ต้องหัดทำเอง หรือไม่ก็ลองค้นในบอร์ด ดูก่อนตั้งคำถามดีป่ะ อย่าบอกนะ ว่าค้นไม่เจอ
|
 |
 |
 |
 |
Date :
2009-11-02 13:17:55 |
By :
ชายน้อย |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
  
|
 |
 |
 |
 |
Date :
2009-11-02 14:13:16 |
By :
ariya99 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เคยทำแล้วนะ แต่จำไม่ได้ว่า อยุ่ในเว็บไหน โทดที หาเจอแล้วจะเอามาให้
|
 |
 |
 |
 |
Date :
2009-11-02 15:30:30 |
By :
tingtongkub |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณ พี่ phpbasic มากๆเลยครับ ขอบคุณน่ะครับ
|
 |
 |
 |
 |
Date :
2009-11-04 08:46:30 |
By :
ิboy415 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
// กรณีวันเกิดที่เก็บสามารถแยกออกเป็นแต่ละส่วน เช่นปี ค.ศ. เดือน และ วัน
// ตัวอย่าง ปีเกิด 1990 เดือนเกิด 2 (กุมภาพันธ์) วันที่ 14
// ฟังก์ชันคำนวณหาอายุใช้ดังนี้
function getAge($year,$month,$day) {
$then = mktime(1,1,1,$month,$day,$year);
return(floor((time()-$then)/31556926));
}
// การใช้งาน
echo getAge(1990,2,14);
// ผลลัพธ์จะได้ 19
?>
<?php
// กรณีวันเกิดที่เก็บอยู่ในรูปแบบของ date แบบมาตรฐาน คือ ปี ค.ศ.- เดือน - วันที่
// ตัวอย่าง 1990-02-14
// ฟังก์ชันคำนวณหาอายุใช้ดังนี้
function getAge($birthday) {
$then = strtotime($birthday);
return(floor((time()-$then)/31556926));
}
// การใช้งาน
$dateB="1990-02-14"; // ตัวแปรเก็บวันเกิด
echo getAge($dateB);
// ผลลัพธ์จะได้ 19
?>
ที่มา : http://www.ninenik.com/คำนวณหาอายุ_จากวันเกิด_ด้วย_php-165.html
|
 |
 |
 |
 |
Date :
2009-11-05 12:35:23 |
By :
patto |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|