ฟังก์ชัน date ใช้คืนสตริงที่จัดรูปแบบตามรูปแบบที่ระบุ โดยให้ integer timestamp หรือเวลาปัจจุบันหากไม่ให้ timestamp
timestamp เป็นทางเลือก และค่าเริ่มต้นคือค่าของ time()
ตัวอย่าง
if(date('j', $timestamp) === '1') echo "It is the first day of the month today\n"; if(date('D', $timestamp) === 'Mon') echo "It is Monday today\n";ผลลัพธ์
จะได้ผลลัพธ์ดังนี้:
It is the first day of the month today