Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incremental Dates

Status
Not open for further replies.
Nov 29, 2002
64
US
Hello everyone,
I need to show incremental dates based on the input from the users. The user first enters the date, and then the number of periods and the type of period (weekly, monthly, etc..). For example:

User input: Date = 05/09/2004 (spanish style DD/MM/YYYY), Number = 4, Period = Weekly.

The result should show:

05/09/2004
13/09/2004
20/09/2004
27/09/2004

I can't figure it our what number should I add in a loop to the initial date... Any ideas?

Thanks!
Alfredo
 
Create a dropdown list for your Period value using the table below:
Value Option
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
n Minute
s Second

Code:
myDate = request.form("txtDate")
myNumber = request.form("txtNumber")
myPeriod = request.form("cboPeriod")
response.write(myDate & "<br>")
For i = 1 to myNumber - 1
    newDate = DateAdd(myPeriod,1,myDate)
    response.write(newDate & "<br>")
    myDate = newDate
Next
This will duplicate your example.
 
hmm... thanks, i didn't think about it... but, what happens if the period is a fortnight? (I hope that's the word in english for 15 days?
cheers,
alfredo
 
hehehehe, ok, some weeks just seem longer :p, the truth is that I just translated from Spanish. In Spanish, fortnight is "QUINCENA" and "QUINCE" means Fifteen....

anyhow, for the quincena I did:

Code:
 <% 
 
 quinc="quincenal" 
 q = 1
 if form_periodo = quinc then q = 2
 form_saldorest = form_saldorest - form_montocuota
 newDate = DateAdd(form_periodo,q,form_fechapago)
    form_fechapago = newDate
Next
%>

and works just fine.

Thanks veep,
alfredo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top