Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > ช่วยดู code นี้ให้หน่อยได้ไหมค่ะว่า ตรงไหนที่มันเป็นการรับค่าให้เป็น mm/dd/yyyy


[PHP] ช่วยดู code นี้ให้หน่อยได้ไหมค่ะว่า ตรงไหนที่มันเป็นการรับค่าให้เป็น mm/dd/yyyy

 
Topic : 078241



โพสกระทู้ ( 46 )
บทความ ( 0 )



สถานะออฟไลน์



Code (PHP)
001.<head><meta http-equiv=Content-Type content="text/html; charset=utf-8"> </head>
002.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
003.<?php
004.// Get values from query string
005.$day = $_GET["day"];
006.$month = $_GET["month"];
007.$year = $_GET["year"];
008.$sel = $_GET["sel"];
009.$what = $_GET["what"];
010.$field = $_GET["field"];
011.$form = $_GET["form"];
012. 
013.if($day == "") $day = date("j");
014. 
015.if($month == "") $month = date("m");
016. 
017.if($year == "") $year = date("Y");
018. 
019.$currentTimeStamp = strtotime("$year-$month-$day");
020.$numDays = date("t", $currentTimeStamp);
021.$monthName = date("F", $currentTimeStamp);
022.$counter = 0;
023./*$numEventsThisMonth = 0;
024.$hasEvent = false;
025.$todaysEvents = "";*/
026.?>
027.<html>
028.<head>
029.<title>ปฏิทิน</title>
030.<link rel="stylesheet" type="text/css" href="calendar.css">
031.<script language="javascript">
032.    function goLastMonth(month,year,form,field)
033.    {
034.        // If the month is January, decrement the year.
035.        if(month == 1)
036.    {
037.    --year;
038.    month = 13;
039.    }       
040.        document.location.href = 'calendar.php?month='+(month-1)+'&year='+year+'&form='+form+'&field='+field;
041.    }
042.     
043.    function goNextMonth(month,year,form,field)
044.    {
045.        // If the month is December, increment the year.
046.        if(month == 12)
047.    {
048.    ++year;
049.    month = 0;
050.    }   
051.        document.location.href = 'calendar.php?month='+(month+1)+'&year='+year+'&form='+form+'&field='+field;
052.    }
053.     
054.    function sendToForm(val,field,form)
055.    {
056.        // Send back the date value to the form caller.
057.        eval("opener.document." + form + "." + field + ".value='" + val + "'");
058.        window.close();
059.    }
060.</script>
061.</head>
062.<body style="margin:0px 0px 0px 0px" class="body">
063.<table width='175' border='0' cellspacing='0' cellpadding='0' class="body">
064.    <tr>
065.        <td width='25' colspan='1'>
066.        <input type='button' class='button' value=' < ' onClick='<?php echo "goLastMonth($month,$year,\"$form\",\"$field\")"; ?>'>
067.        </td>
068.        <td width='125' align="center" colspan='5'>
069.        <span class='title'><?php echo $monthName . " " . $year; ?></span><br>
070.        </td>
071.        <td width='25' colspan='1' align='right'>
072.        <input type='button' class='button' value=' > ' onClick='<?php echo "goNextMonth($month,$year,\"$form\",\"$field\")"; ?>'>
073.        </td>
074.    </tr>
075.    <tr>
076.        <td class='head' align="center" width='25'>S</td>
077.        <td class='head' align="center" width='25'>M</td>
078.        <td class='head' align="center" width='25'>T</td>
079.        <td class='head' align="center" width='25'>W</td>
080.        <td class='head' align="center" width='25'>T</td>
081.        <td class='head' align="center" width='25'>F</td>
082.        <td class='head' align="center" width='25'>S</td>
083.    </tr>
084.    <tr>
085.<?php
086.    for($i = 1; $i < $numDays+1; $i++, $counter++)
087.    {
088.        $timeStamp = strtotime("$year-$month-$i");
089.        if($i == 1)
090.        {
091.        // Workout when the first day of the month is
092.        $firstDay = date("w", $timeStamp);
093.         
094.        for($j = 0; $j < $firstDay; $j++, $counter++)
095.        echo "<td> </td>";
096.        }
097.         
098.        if($counter % 7 == 0)
099.        echo "</tr><tr>";
100.         
101.        if(date("w", $timeStamp) == 0)
102. 
103.        $class = "class='weekend'";
104.        else
105.        if($i == date("d") && $month == date("m") && $year == date("Y"))
106.        $class = "class='today'";
107.        else
108.        $class = "class='normal'";
109.         
110.        echo "<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick=\"sendToForm('".sprintf("%02d/%02d/%04d", $i, $month, $year)."','$field','$form');\"><font $class>$i</font></a></td>";
111.    }
112.?>
113.    </tr>
114.</table>
115.</body>
116.</html>




Tag : PHP, MySQL

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-05-11 09:37:27 By : juneneka View : 902 Reply : 5
 

 

No. 1



โพสกระทู้ ( 23 )
บทความ ( 0 )



สถานะออฟไลน์


งงคำถามครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-05-11 12:45:10 By : tannabor
 

 

No. 2



โพสกระทู้ ( 114 )
บทความ ( 0 )



สถานะออฟไลน์


อันนี้ครับ

onclick=\"sendToForm('".sprintf("%02d/%02d/%04d", $i, $month, $year)."','$field','$form');\"

ถ้าจะให้เป็น mm/dd/YYY ให้เปลี่ยนเป็น

onclick=\"sendToForm('".sprintf("%02d/%02d/%04d", $month, $i, $year)."','$field','$form');\"
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-05-11 21:02:03 By : tongjaab
 

 

No. 3



โพสกระทู้ ( 46 )
บทความ ( 0 )



สถานะออฟไลน์


อันนี้จูนลองเปลี่ยนแล้วค่ะ ค่ามันเปลี่ยนจริง แต่มันยังอยู่ในรูปแบบ mm/dd/yyyy ทั้งๆที่ ค่าเปลี่ยนเปน dd/mm/yyyy แล้ว งงจริงๆ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-05-12 14:54:02 By : juneneka
 

 

No. 4



โพสกระทู้ ( 3,156 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


ลองคลิ๊กขวาแล้ว view source ได้ผลลัพธ์แบบนี้ครับ

Code (PHP)
01.<tr>
02.<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick="sendToForm('01/05/2012','','');"><font class='normal'>1</font></a></td>
03.<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick="sendToForm('02/05/2012','','');"><font class='normal'>2</font></a></td>
04.<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick="sendToForm('03/05/2012','','');"><font class='normal'>3</font></a></td>
05.<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick="sendToForm('04/05/2012','','');"><font class='normal'>4</font></a></td>
06.<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick="sendToForm('05/05/2012','','');"><font class='normal'>5</font></a></td>
07.</tr>
08.<tr>
09.<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick="sendToForm('06/05/2012','','');"><font class='weekend'>6</font></a></td>
10.<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick="sendToForm('07/05/2012','','');"><font class='normal'>7</font></a></td>
11.<td class='tr' bgcolor='#ffffff' align='center' width='25'><a class='buttonbar' href='#' onclick="sendToForm('08/05/2012','','');"><font class='normal'>8</font></a></td>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-05-12 16:32:05 By : sakuraei
 

 

No. 5



โพสกระทู้ ( 476 )
บทความ ( 2 )



สถานะออฟไลน์
Twitter Facebook Hi5 Blogger

ความต้องการ จะทำอะไรครับ
ถ้าต้องการใช้ปฏิทิน แนะนำใช้ jquery datepicker ง่ายกว่าครับ
http://jqueryui.com/demos/datepicker/

หากไม่ใช่ก็ขออภัยครับ


ประวัติการแก้ไข
2012-05-12 16:47:34
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-05-12 16:40:38 By : boodemon
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดู code นี้ให้หน่อยได้ไหมค่ะว่า ตรงไหนที่มันเป็นการรับค่าให้เป็น mm/dd/yyyy
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่