D
Drew
I am trying to build a page to generate some random data for a database that
I am working on... I thought this would be simple, but it has proven to be
more difficult... I am trying to create some functions to build a random
date. It keeps returning a string like, "9172006//" instead of "9/17/2006".
What's making this do that?
Function RandomNumber(min,max)
dim rand
rand = Int((max-min+1)*Rnd+min)
Response.Write(rand)
End Function
Function RandomDate()
dim M
dim D
dim Y
dim randdate
M = RandomNumber(1,12)
If M <> 2 OR M <> 4 OR M <> 6 OR M <> 9 OR M <> 11 Then
D = RandomNumber(1,31)
ElseIf M <> 2 Then
D = RandomNumber(1,30)
ElseIf M = 2 Then
D = RandomNumber(1,28)
End If
Y = RandomNumber(2005,2007)
randdate = M & "/" & D & "/" & Y
Response.Write(randdate)
End Function
For i = 1 to 500
varRandomDate = RandomDate()
End If
Thanks!
Drew
I am working on... I thought this would be simple, but it has proven to be
more difficult... I am trying to create some functions to build a random
date. It keeps returning a string like, "9172006//" instead of "9/17/2006".
What's making this do that?
Function RandomNumber(min,max)
dim rand
rand = Int((max-min+1)*Rnd+min)
Response.Write(rand)
End Function
Function RandomDate()
dim M
dim D
dim Y
dim randdate
M = RandomNumber(1,12)
If M <> 2 OR M <> 4 OR M <> 6 OR M <> 9 OR M <> 11 Then
D = RandomNumber(1,31)
ElseIf M <> 2 Then
D = RandomNumber(1,30)
ElseIf M = 2 Then
D = RandomNumber(1,28)
End If
Y = RandomNumber(2005,2007)
randdate = M & "/" & D & "/" & Y
Response.Write(randdate)
End Function
For i = 1 to 500
varRandomDate = RandomDate()
End If
Thanks!
Drew