Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts

    date code PHP-->Js

    Below is code(XHTML) for two date pickers(drop-down menues) well follows a php processor find days between dates inserted ? How I find this in javascript ? Also A visitor how to see current date(GMT+2) in the two drop-down menues groups... remember only gmt+2 but not include time just date ?

    Code:
    <td align="right" valign="middle">
                From Date:</td>
                <td><font face="Arial, Helvetica, sans-serif" size="2">
                  <select name="day" size="1" class="formfields" id="day" tabindex="22" ;>
                    <option value="1" selected="selected">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                    <option value="11">11</option>
                    <option value="12">12</option>
                    <option value="13">13</option>
                    <option value="14">14</option>
                    <option value="15">15</option>
                    <option value="16">16</option>
                    <option value="17">17</option>
                    <option value="18">18</option>
                    <option value="19">19</option>
                    <option value="20">20</option>
                    <option value="21">21</option>
                    <option value="22">22</option>
                    <option value="23">23</option>
                    <option value="24">24</option>
                    <option value="25">25</option>
                    <option value="26">26</option>
                    <option value="27">27</option>
                    <option value="28">28</option>
                    <option value="29">29</option>
                    <option value="30">30</option>
                    <option value="31">31</option>
                  </select>
                  <select name="month" size="1" class="formfields" id="month" tabindex="23" ;>
                    <option value="1" selected="selected">January</option>
                    <option value="2">February</option>
                    <option value="3">March</option>
                    <option value="4">April</option>
                    <option value="5">May</option>
                    <option value="6">June</option>
                    <option value="7">July</option>
                    <option value="8">August</option>
                    <option value="9">September</option>
                    <option value="10">October</option>
                    <option value="11">November</option>
                    <option value="12">December</option>
                  </select>
                  <select name="year" size="1" class="formfields" id="year" tabindex="25" ;>
                    <option value="2008" selected="selected">2008</option>
                    <option value="2009">2009</option>
                    <option value="2010">2010</option>
                  </select>
                </font></td>
              </tr>
              <tr>
                <td align="right" valign="middle">
                To Date:</td>
                <td><font face="Arial, Helvetica, sans-serif" size="2">
                  <select name="today" size="1" class="formfields" id="select" tabindex="22" ;>
                    <option value="1" selected="selected">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                    <option value="11">11</option>
                    <option value="12">12</option>
                    <option value="13">13</option>
                    <option value="14">14</option>
                    <option value="15">15</option>
                    <option value="16">16</option>
                    <option value="17">17</option>
                    <option value="18">18</option>
                    <option value="19">19</option>
                    <option value="20">20</option>
                    <option value="21">21</option>
                    <option value="22">22</option>
                    <option value="23">23</option>
                    <option value="24">24</option>
                    <option value="25">25</option>
                    <option value="26">26</option>
                    <option value="27">27</option>
                    <option value="28">28</option>
                    <option value="29">29</option>
                    <option value="30">30</option>
                    <option value="31">31</option>
                  </select>
                  <select name="tomonth" size="1" class="formfields" id="select5" tabindex="23" ;>
                    <option value="1" selected="selected">January</option>
                    <option value="2">February</option>
                    <option value="3">March</option>
                    <option value="4">April</option>
                    <option value="5">May</option>
                    <option value="6">June</option>
                    <option value="7">July</option>
                    <option value="8">August</option>
                    <option value="9">September</option>
                    <option value="10">October</option>
                    <option value="11">November</option>
                    <option value="12">December</option>
                  </select>
                  <select name="toyear" size="1" class="formfields" id="select3" tabindex="25" ;>
                    <option value="2008" selected="selected">2008</option>
                    <option value="2009">2009</option>
                    <option value="2010">2010</option>
                  </select>
                </font></td>
    Code:
    $day = $_POST['day'];
    $month = $_POST['month'];
    $year = $_POST['year'];
    $today = $_POST['today'];
    $tomonth = $_POST['tomonth'];
    $toyear = $_POST['toyear'];
    
    		$tsp = mktime(0, 0, 0, $month, $day, $year);
    		$tsd = mktime(0, 0, 0, $tomonth, $today, $toyear);
    		$xdays = ($tsd - $tsp)/(24*60*60);  // as calculated from dates

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,907
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    567 posts, 0 thanks. No response.

  • #3
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    by saying "Thank" what you mean to do ?

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,907
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Are there no words for "please" and "thank you" in your language?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •