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
Mouseover to edit (Ajax)
hi friends, can anyone help with the code behind to get this application working, please in VB (new
login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php
Parse error: syntax error, unexpected T_ELSEIF in /home/......html/item.php on l
I do not know what is wrong with this. Hope some one can help. I do nto want to post the entire site
can i optmize image to 50% quality before uploading 2 server
Hi there
i have jus written a php program to upload and display images but when i try to uplo
cURL proxy
Okay here is the thing... i know how to add proxys
Code: curl_setopt($ch, CURLOPT_PROXYTYPE,
Needing Youtube thumb nail fix.
I have a script on a site that pulls in you-tube videos,
The problem is, that the thumb nails for
Error when call dll from oracle
Hi all, please help me!
I have dll write C language, I want call it from oracle procedur
TemplatePower & AJAX
Hi all,
I'm currently implementing some AJAX features in my PHP-framework (which is b
how do I show what a user have selected from a checkbox?
From my code below, how would i show which check boxes have been checked and which radio buttons sel
images aren't rendering
I'm trying to call a JPG file from within PHP (in an effort to hide the actual JPG folder). The imag