472,353 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

How to calculate the expired date when the topupAmount and topupdate are given


I have a question,i need to do a task which is when client enter the topupdate and topupamount,the expected expired date will appear on the table,can anyone help me since i have spend 2 weeks to do this.i had try dateAdd function but still cannot. Here are my sample coding

if Request.QueryString("S_MobileNo") <> EMPTY then
recordSet("MobileNo") = Request.QueryString("S_MobileNo")
end if
if Request.QueryString("S_ServiceType") <> EMPTY then
recordSet("ServiceType") = Request.QueryString("S_SeviceType")

end if
if Request.QueryString("S_State") <> EMPTY then
recordSet("State") = Request.QueryString("S_State")
end if
if Request.QueryString("S_Location") <> EMPTY then
recordSet("Description") = Request.QueryString("S_Location")
end if
if Request.QueryString("S_TopupDate") <> EMPTY then
if IsDate(Request.QueryString("S_TopupDate")) then
DateStr = Day(Request.QueryString("S_TopupDate")) & "/" & Month(Request.QueryString("S_TopupDate")) & "/" & Year(Request.QueryString("S_TopupDate"))
recordSet("TopupDate") = DateStr
end if
end if
if Request.QueryString("S_TopupAmount") <> EMPTY then
if isnumeric(Request.QueryString("S_TopupAmount")) then
recordSet("TopupAmount") = Request.QueryString("S_TopupAmount")
end if
end if
if Request.QueryString("S_ExpiredDate") <> EMPTY then
d_added=DateAdd("d",TopupAmount,TopupDate) 'ExpiredDate = TopupDate + TopupAmount'
end if
if Request.QueryString("S_owner") <> EMPTY then
recordSet("owner") = Request.QueryString("S_owner")
end if
if Request.QueryString("S_remark") <> EMPTY then
recordSet("remark") = Request.QueryString("S_remark")
end if

Set connectionToDatabase=Nothing

Plz help Me!!Tq
Aug 23 '07 #1
6 1596
130 Expert 100+
Expand|Select|Wrap|Line Numbers
  1. if Request.QueryString("S_TopupDate") <> EMPTY then
  2. if IsDate(Request.QueryString("S_TopupDate")) then 
  3. DateStr = Day(Request.QueryString("S_TopupDate")) & "/" & Month(Request.QueryString("S_TopupDate")) & "/" & Year
You are returning a string from the QueryString depending how you send the S_TopupDate, it may not be a valid date. You could do
Expand|Select|Wrap|Line Numbers
  1. Response.Write(IsDate(Request.QueryString("S_TopupDate")) 
then you can verify if it is returning as a valid date. If you are passing something like 08212007, that will return false.
Aug 23 '07 #2
thanx but i want to solve my problem regarding how to calculate expired date if the topup date and amount of the prepaid card is given..plz anyone can help??
Aug 27 '07 #3
346 Expert 100+
Er, this sounds like you are trying to add a monetary value to a date - which won't work.

What context is TopUpAmount? Is it a monetary value, an integer, or a date in itself?
Aug 28 '07 #4
topupamount is currency,when user topup his/her prepaid the expired date for the credit will be count by this system.

tq and plz anyone help me!!!
Sep 3 '07 #5
346 Expert 100+
Well then that's your first problem

How do you hope to add a currency value to a date?

You're basically saying : add $24 to September 2nd 2007
Sep 3 '07 #6
but topupamount is the day because when you topup 30,the expired date will be increased to 30 days more.
Sep 4 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

by: CrystalDBA | last post by:
I am using SQL Server 2000. I need to query my database for all the contracts that came in during a certain time frame (user is prompted for...
by: William Bradley | last post by:
In a database I have a table that amongst other cells has a "current date" cell, and "expired date" cell and an "Index Number" cell. The "index...
by: carl.barrett | last post by:
Hi, I have a continuous form based on a query ( I will also be creating a report based on the same query). There are 2 fields: Date...
by: Laery | last post by:
Hi, I'm currently adding a new module to an old borland C3.1 application (dos). And I need to calculate a date by subtracting the number of days...
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the...
by: Amanda | last post by:
This is hotel reservation when a departure date is changed manually by user input ( to a valid date in date format - validity is checkedsomewhere...
by: sharsy | last post by:
Hello guys, I would like some help in generating query criteria that will identify credit cards that have expired on an access database. The...
by: Vince | last post by:
Given a week Number, how do I calculate the date that for the Monday of that week?
by: OuTCasT | last post by:
Hi All I need to add 3 months to a date so i can calculate when a clients email bundle is out dated. so for instance the client registed his...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.