Date and Time Functions
posted on 06 Mar 2008 09:18 by xnanoob in PHP- ดีค่า วันนี้มาดูเรื่อง function Date Time ใน javascript นะค่ะ ก้อไปสร้าง object มาจาก class Date (ตัวเล็กตัวใหญ่มีผลนะ) หลังจากนั้นก้อจะมี method ให้ใช้พวก getYear getMonth getDate getDay getHours และสุดท้ายก้อ getTime
| currentTime = new Date(); |
- getYear() return ค่าพวก 2008
- getMonth() return ค่า 0 ถึง 11 ตั้งแต่มกราคมถึงธันวาคม
- getDate() Returns วันของเดือนนั้นๆ
- getDay() return วันของสัปดาห์ ศูนย์จะเป็นวันอาทิตย์
- getHours() Returns ค่า 0 ถึง 23 คือชั่วโมงของวัน
- getTime() Returns Tick Time
| <SCRIPT LANGUAGE="JavaScript"> function t(){ currentTime = new Date(); alert(currentTime); alert("year"+currentTime.getYear()); alert("month"+currentTime.getMonth()); alert("date"+currentTime.getDate()); alert("day"+currentTime.getDay()); alert("hours"+currentTime.getHours()); alert(new Date().getTime()); } </SCRIPT> |
จบแระค่ะ บายคะ งุ

apartment ให้เช่า เช่าอาร์พาร์ทเม้นต์ ใกล้เซ็นทรัลลาดพร้าว สนใจติดต่อได้เลย ชมห้องตัวอย่าง กด นะค่ะ
edit @ 6 Mar 2008 11:19:22 by xnanoob
Tags: date, javascript, time3 Comments








#1 By เอกน้อย on 2008-03-06 16:13