Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: DateAdd()


Message #1 by "Brad Murray" <brad@b...> on Sun, 3 Sep 2000 16:32:06 -0400
Does anybody know why the DateAdd function doesn't work?  When I call the

following function:



DateAdd("d", 1, CDate("9/1/2000"))



I get Compiler Error Message: BC30557: A string can not be used where a

numeric type is required; use the Val function to explicitly convert a

string to a number.



It doesn't like the "d" as a string.  I guess it is looking for a constant

of some sort, but the documentation says it should be a string.



Message #2 by "Fredrik Normen" <fredrik.normen@s...> on Tue, 5 Sep 2000 15:08:28 +0100
Here you have an expamle how to use DateTime in ASP+



<html>

<head>

<script language="Vb" runat="server">



	protected Sub Page_Load(Source As Object, E As EventArgs)



		Dim dt as DateTime = #2000-10-10#

		Datum.Text = dt.AddMonths(1).ToString



	end sub



</script>



<ASP:Label Id="Datum" RUNAT="Server"/>



/Fredrik Normen

Message #3 by "Fredrik Normen" <fredrik.normen@s...> on Tue, 5 Sep 2000 15:18:32 +0100
If you want to use tha DateAdd function you change the "d" to 2



DateAdd(2, 1, CDate("9/1/2000"))



But I recommand you to look at my preview answer, there I use the DataTime

class.



/Fredrik Normen




  Return to Index