Forum Moderators: open

Message Too Old, No Replies

Today function

         

JohnWise

3:02 pm on Feb 4, 2003 (gmt 0)

10+ Year Member



Using VB.net. Trying to utilize the Today function. I have tried setting variables to String, Integer, Date and nothing seems to work. Anyone with any suggestions, appreciated.

Sub Page_Load(Sender As Object, E As EventArgs)
DatePurchased.Text = Today
End Sub

I have tried a simple screen display in the body part of my code. Just to display the date. Getting nada.
Thanks.

wardbekker

3:25 pm on Feb 4, 2003 (gmt 0)

10+ Year Member



JohnWise,

Try

DatePurchased.Text =DateTime.Today.ToLongDateString()

JohnWise

3:44 pm on Feb 4, 2003 (gmt 0)

10+ Year Member



Thanks, but no go. I even tried Too instead of To.

wardbekker

3:56 pm on Feb 4, 2003 (gmt 0)

10+ Year Member



What error do you get?

Did you import System.DateTime?

JohnWise

4:08 pm on Feb 4, 2003 (gmt 0)

10+ Year Member



I didn't think I had to import anything. According to this text I am using, Asp.net automatically makes all this available. And my host claims to support .net.
I am simply typing in some code from this text and running into this problem. I get the default error page. But I do know that the error is with the Today function. By process of eliminating and adding code.

wardbekker

4:24 pm on Feb 4, 2003 (gmt 0)

10+ Year Member



JohnWise,

I would recommend you alter your web.config so you can look at the error message. You need to reference the System.DateTime namespace. Otherwise your only option is to specify the complete namespace ( System.DateTime.Today.ToLongDateString() )