Classic asp date displays- changing over to aspnet date object displays

  • Thread starter Thread starter Chumley Walrus
  • Start date Start date
C

Chumley Walrus

I'm changing an old classic asp script over to asp.net; it displays
links corresponding to each day of the week

<script runat="server">

Sub Page_Load(s As Object, e As EventArgs)



</script>

<%



'DateTime.Now will be the current date indicator



dim currentDate,noshowyet,numDays,i

currentDate = DateTime.Now

noShowYet = false

if hour(currentDate) < 12 and weekday(currentDate) <> 2 then

currentDate = dateadd("d",-1,currentDate)

elseif hour(currentDate) < 12 then

Response.Write("[ Today's show will be ready by 12:00 pm PST")

noShowYet = true

end if

select case weekday(currentDate)

case 1

numDays = 5

currentDate = dateadd("d",-6,currentDate)

case 2

numDays = 1

case 3

numDays = 2

currentDate = dateadd("d",-1,currentDate)

case 4

numDays = 3

currentDate = dateadd("d",-2,currentDate)

case 5

numDays = 4

currentDate = dateadd("d",-3,currentDate)

case 6

numDays = 5

currentDate = dateadd("d",-4,currentDate)

case 7

numDays = 5

currentDate = dateadd("d",-5,currentDate)

end select

if not noShowYet then

for i=1 to numDays



select case weekday(currentDate)

case 2

Response.Write("[ <A HREF=prMonday.asx>Monday</A> ")

case 3

Response.Write("| <A HREF=prTuesday.asx>Tuesday</A> ")

case 4

Response.Write("| <A HREF=prWednesday.asx>Wednesday</A> ")

case 5

Response.Write("| <A HREF=prThursday.asx>Thursday</A> ")

case 6

Response.Write("| <A HREF=prFriday.asx>Weekend</A> ")

case else

Response.Write("error in select case: invalid day of week")

end select



currentDate = dateadd("d",1,currentDate)

next

end if

%>

where's a good reference to refer to date objects for asp.net (or what
are some of the comparable functions that asp.net uses to parse each
date format)?

Thanks in advance
Chumley
 
Hi,

The System.DateTime class is very robust in .net. I do not think that you
will have any issues at all porting your code over. I have posted a couple
of links for you to help you get started. If you need more specifc help
please reply to this post.

Hope this helps.
 
Back
Top