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
Getting Resource id #11 while trying to connect..
So i tried using "DEFINE" for the first time and im using the variables i defined to conne
Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I
same querie, or a new one??
Hi guys,
I'm still working on this drop down list. I've got the actual drop down list to wor
opening a window with after form submission
I know this this forum has nothing to do with JS, but i'm trying to use it with my php script.
<
Passing PHP variables from one page to another
Hello-
I'm having trouble figuring out how to transport a variable from one php file to anoth
SQL Query/echo not working
Hey all,
I'm trying to run (what I thought) was a simple operation and it isn't working. I h
Backflush
I am looking for a report in SAP that would give me a list of all parts that are populated with a ba
Populate drop down list from table??
Lets say for arguments sake that i have a table which contains the numbers 1 to 10.
How can i get
Reg Ex
Im trying to search for the string: srv_9 (Dead ???)
I thought to use preg_match, however I d
download directory onto C drive
I am attempting (if this is possible) to write a routine to automatically dump the contents of a dir