Working with Dates, help.
Posted on
16th Feb 2014 07:03 pm by
admin
Sooo to make a long story short, here's what im trying to accomplish.
I need to create a dropdown list of months, where the starting month is current month and the ending month is the previous months 2 years earlier.
Example of static version
Code: [Select]<option VALUE="">-Month-</option>
<option VALUE="0" >Oct-2009</option>
<option VALUE="1" >Sep-2009</option>
<option VALUE="2" >Aug-2009</option>
<option VALUE="3" >Jul-2009</option>
<option VALUE="4" >Jun-2009</option>
<option VALUE="5" >May-2009</option>
<option VALUE="6" >Apr-2009</option>
<option VALUE="7" >Mar-2009</option>
<option VALUE="8" >Feb-2009</option>
<option VALUE="9" >Jan-2009</option>
<option VALUE="10" >Dec-2008</option>
<option VALUE="11" >Nov-2008</option>
<option VALUE="12" >Oct-2008</option>
<option VALUE="13" >Sep-2008</option>
<option VALUE="14" >Aug-2008</option>
<option VALUE="15" >Jul-2008</option>
<option VALUE="16" >Jun-2008</option>
<option VALUE="17" >May-2008</option>
<option VALUE="18" >Apr-2008</option>
<option VALUE="19" >Mar-2008</option>
<option VALUE="20" >Feb-2008</option>
<option VALUE="21" >Jan-2008</option>
<option VALUE="22" >Dec-2007</option>
<option VALUE="23" >Nov-2007</option>
<option VALUE="24" >Oct-2007</option>
<option VALUE="25" >Sep-2007</option>
<option VALUE="26" >Aug-2007</option>
<option VALUE="27" >Jul-2007</option>
<option VALUE="28" >Jun-2007</option>
Now it's easy to figure out current month through getDate();
The loop is relatively easy also. But i dont know how to use the date to subtract if you will the months and years from the current date.
So all in all i need to create the code above dynamically.
Thanks Guys
No comments posted yet
Your Answer:
Login to answer
212
26
Other forums
Reditecting pages based on logic
Newbie here, apologies in advance!
I am trying to use the header function to forward one of a
Odd or Even
Inside of a while loop I need to echo several rows of info...easy enough.
In the loop (for th
php and downloading
I want to use a php script to create two files. Then I want it to redirect (or whatever) to have tho
Read from a text file after a specific word
Hi all.
I have a text file that looks like the one below.
I know how to open the text fi
Making multiple rows with one query
I have a table called efed_handler_characters with two fields handler_id and bio_id. What query 2 is
Problem with PHP code- simple contact form
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form wit
Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r
INSERT data problem!
After having an string with apostrophes ', double quotes " or any other special characters, suc
PHP mail() returns true but doesn't work
First off I apologize if this is a newbie question, and I generally don't like asking questions that
convert static html data into dynamic
hi all
i need to convert a website which has static above 2000 articles into dynamic and add