Reputation: 325
I'm trying to set a variable to today's date using VB within an ASPX file. Does anyone know the correct syntax?
Upvotes: 0
Views: 2967
Reputation: 21795
Try this:-
This will declare your date
variable:-
<% Dim date As String = DateTime.Now.ToShortDateString() %>
This will print the value of variable date on response:-
<%= date %>
Upvotes: 1
Reputation: 15923
Try this as you wish to declare and assign the variable, you can use it further in your code
<% Dim a As String = DateTime.Now.ToShortDateString()%>
Upvotes: 1
Reputation: 38745
>> WScript.Echo Date()
>> WScript.Echo Now()
>>
23.04.2015
23.04.2015 12:15:46 ' <-- german locale
Upvotes: 1