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
Drop Down and text box issue
Is it possible to set a drop down list and text boxes to a certain width?
here is my code
tell csv import script to ignore blank rows?
Hi i have the below script but i get an error if a row is blank ie a return in the csv file at the e
problems with php variables in mysql query
i can't seem to get the following query to work.
select $q1c from $vote_rate where id = $re
Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so
System copy error in RUN ABAP REPORT PHASE
Hi,
I am performing system copy on my test server. I have previously taken export of JAVA + A
how to hide input fields on selection screen using variant attribute
Hello all,
I want to know how to hide input fields on selection screen using variant attr
Trouble with a select list
Hello All!
I was wondering if any of you guys could help me with a small problem I'm having!
mr8m - reverse document
Friends,
I'm trying to reverse a document held by MIRO, but it reports the message balan
Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time
Problem with passing variables
I'm not really a php programmer so I'm really struggling with this issue.
I have a banner s