PHP combining variables into a timestamp

Discussion in 'Web Design and Development' started by jordanste, Mar 10, 2008.

  1. jordanste macrumors member

    Joined:
    Feb 25, 2006
    #1
    so i have a form where users are posting dates for events that they are holding. i have the form set up like this

    PHP:
        <tr>
            <
    td>
            
    Date:
            </
    td>
            <
    td>
            <
    select name='month'>
            <
    option value=>mm</option>
            <
    option value=01>1</option>
            <
    option value=02>2</option>
            <
    option value=03>3</option>
            <
    option value=04>4</option>
            <
    option value=05>5</option>
            <
    option value=06>6</option>
            <
    option value=07>7</option>
            <
    option value=08>8</option>
            <
    option value=09>9</option>
            <
    option value=10>10</option>
            <
    option value=11>11</option>
            <
    option value=12>12</option>
            </
    select> /
            <
    select name='day'>
            <
    option value=>dd</option>
            <
    option value=01>1</option>
            <
    option value=02>2</option>
            <
    option value=03>3</option>
            <
    option value=04>4</option>
            <
    option value=05>5</option>
            <
    option value=06>6</option>
            <
    option value=07>7</option>
            <
    option value=08>8</option>
            <
    option value=09>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='year'>
            <
    option value=>yyyy</option>
            <
    option value=2005>2005</option>
            <
    option value=2006>2006</option>
            <
    option value=2007>2007</option>
            <
    option value=2008>2008</option>
            <
    option value=2009>2009</option>
            <
    option value=2010>2010</option>
            </
    select>
            </
    td>
        </
    tr>
        <
    tr>
            <
    td>
            
    Time:
            </
    td>
            <
    td>
            <
    select name='hour'>
            <
    option value=1>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 selected="selected">8</option>
            <
    option value=9>9</option>
            <
    option value=10>10</option>
            <
    option value=11>11</option>
            <
    option value=12>12</option>
            </
    select>&nbsp:
            <
    select name='min'>
            <
    option value="00" selected="selected">00</option>
            <
    option value=15>15</option>
            <
    option value=30>30</option>
            <
    option value=45>45</option>
            </
    select>&nbsp
            
    <select name=ampm>
            <
    option value=am>am</option>
            <
    option value=pm selected="selected">pm</option>
            </
    select>
            </
    td>
        </
    tr>
    with the day, month, year, and time seperated into different variables, now how would i go about combining all of this input into one unix timestamp integer (in seconds) so that i can do math on it... any ideas?
     
  2. Malfoy macrumors 6502a

    Malfoy

    Joined:
    Nov 1, 2005
    #2
  3. jordanste thread starter macrumors member

    Joined:
    Feb 25, 2006
    #3
    nur, i knew it couldnt be that complicated...


    thanks!

    i had no idea that existed.
     

Share This Page