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
first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see
problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo
Packet Design
Hi All,
Im new about network programming and I want to design a protocol but I have some question
When i am Canseling the Billing Document in VF11 I am getting Shortdump
Hi Experts
When i am Canseling the Billing Document in VF11 I am getting Shortdump.
How to Handle more than one submit button in single form?
Hi
I have one PHP file which contains one Form. In this form there are two Submit type Buttons
How to convert this array to string
I am having problems converting this array to a string
using print_r($val[1]); I get:
Code: [
Delete Client 066 Earlywatch
Hi all,
in former times client earlywatch was required for SAPs remote access to SAP inst
Kill a process
I have a question - how can I kill a process from a command line or by using Oracle SQL Developer? I
PHP4 to PHP5 Conversion
Hi Everyone,
I am working on a site that is built up on PHP4 and each page is being started f
email CODING Problem
Email coding problem.
I need to send a section of the info to $tf and the same as a Cc to $em