homepage Welcome to WebmasterWorld Guest from 23.23.12.202
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
I need a simple script...
please help...
Gert_Jan

10+ Year Member



 
Msg#: 1857 posted 12:52 pm on Jun 2, 2004 (gmt 0)

Hey Guys,

I need two simple ASP scripts.

1) A date function that adds 30 days to to the current date ( i will use it als a value in a dropdownlist...)

2) A script that compares the current date to a date i get from a recordset. If the dates are the same if should redirect the user to an URL.

Thanks for your help

GJ

 

txbakers

WebmasterWorld Senior Member txbakers us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 1857 posted 1:16 pm on Jun 2, 2004 (gmt 0)

These are very simple, but different depending on your database and language

mySQL has a DATE_ADD function which you can build right into the SQL statement.

VB has a dateadd() function which you can use on the script itself.

JavaScript doesn't have a native date add function, but I found a way to do it with a few lines of code.

tafkar

10+ Year Member



 
Msg#: 1857 posted 1:20 pm on Jun 2, 2004 (gmt 0)

Hi Gert_Jan

hope this helps:

1) MyDate = DateAdd("d",30,Date())

2) if Date() = FormatDateTime(YourRecordsetValue,2) then Response.Redirect "/YourRedirectionURL.asp"

cheers

tafkar

tafkar

10+ Year Member



 
Msg#: 1857 posted 1:21 pm on Jun 2, 2004 (gmt 0)

ooops, txbakers beats me to it :-)

dotme

10+ Year Member



 
Msg#: 1857 posted 1:54 pm on Jun 2, 2004 (gmt 0)

Only one thing I might add to this - If your ASP dropdown is supposed to contain *all* dates between now and 30 days from now, this code should do it...

<%
response.write "<select size='1' name='mydate'>" & chr(13)
For i = 0 to 30
thisdate = Date + i
response.write "<OPTION VALUE='" & thisdate & "'>" & formatdatetime(thisdate,1) & "</OPTION>" & chr(13)
Next
response.write "</select>" & chr(13)
%>

Gert_Jan

10+ Year Member



 
Msg#: 1857 posted 2:37 pm on Jun 2, 2004 (gmt 0)

Thnk you for the help! Gat the date thing working!

Except the comparison... whats wrong with this?

Thanks in advance

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT mem_id, mem_name, mem_email, mem_subsc, mem_start_date, mem_end_date FROM members WHERE mem_name = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>

<%
if Date() = FormatDateTime(mem_end_date,2) then Response.Redirect "http://www.webmasterworld.com"
%>

GJ

Gert_Jan

10+ Year Member



 
Msg#: 1857 posted 2:47 pm on Jun 2, 2004 (gmt 0)

Thnk you for the help! Gat the date thing working!

Except the comparison... whats wrong with this?

Thanks in advance

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT mem_id, mem_name, mem_email, mem_subsc, mem_start_date, mem_end_date FROM members WHERE mem_name = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>

<%
if Date() = FormatDateTime(mem_end_date,2) then Response.Redirect "http://www.webmasterworld.com"
%>

GJ

Gert_Jan

10+ Year Member



 
Msg#: 1857 posted 3:20 pm on Jun 2, 2004 (gmt 0)

Already got it!

Thanks anyway!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved