Working with Dates:
There are many reasons you might want to use dates in your web page. Maybe you just want to display the date on the page.
Or maybe you want to check to see if today's date is a specific date and if so, show a special announcement on the page.
You could also set a function to run and then automatically end it on a specific date. Another fun trick is to display a
countdown to a specific event. Before writing your code in VB.Net or C#, you may want to check and see if you can write it in
JavaScript instead so that it will run on the client instead of the server. You might want to look at AJAX and use the timer control.
Below is a simple of example of how to display the current time and date. Since
this was written on the server side (VB.NET) instead of the client side
(JavaScript) the time and date will only be updated when you hit refresh. This
scenerio may work fine if you only want to display the date and not the time.
Display Date
VB.NET CODE
dim theTime = Now()
lblDisplayTime.text = theTime
ASP.NET CODE
<asp:label ID="lblDisplayTime" runat="server" />
Here is the time you downloaded the page: 5/20/2012 8:13:35 PM
VB.NET vs. C#
Variables
Decisions
Built In Functions