Pages

Monday, March 12, 2012

Get the Weekday name from your Date string (ASP.NET)

Do you have a date string that you want to use to return the Weekday name in ASP.NET? First, convert the string to a date value then apply the dddd string format to the date value, like so:

Dim tdate As Date = CType("9/1/2004", Date)
Dim wkday as string = tdate.ToString("dddd")

When this code executes, the value of wkday will be Wednesday. Using the following code, you can also return the Weekday abbreviation - Wed:

wkday = tdate.ToString("ddd")


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.