I have a number of dates formatted as:
03/26/199206/12/201001/01/1995
etc. in DD / MM / YYYY. I need to find a day like Tuesday, Monday, etc. Of them.
I know that I need to parse a date or something else, but I'm not sure how to do it.
You can use it as a DateTime and use the DayOfWeek property, which returns a DayOfWeek counter.
Not sure about VB.NET, but in C # he likes
DateTime.Now.DayOfWeek or DateTime.Parse(theDateString).DayOfWeek
You want to see format strings for the ToString method. MyDate.ToString("dddd") will provide you with what you want.
MyDate.ToString("dddd")
DateTime.Parse("2010/12/31").dayofweek
'Declaration <SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public Class ArgumentOutOfRangeException Inherits ArgumentException Implements ISerializable 'Usage Dim instance As ArgumentOutOfRangeException
The best thing that works for me in vb 2010 is
I add a timer and turn it on, then I put it like this
Label6.Text = Format(Now, "dddd/dd")
"dd" gives me a num day. "dddd" gives me the name of the day
"dd"
"dddd"
See the documentation for DateTime members. Parse, TryParse, DayOfWeek and ToString.
Try
dateValue.DayOfWeek.ToString()
Convert date to date data type, then use format function. This is displayed on Monday:
Dim d As Date d = "11/23/2009" MsgBox(Format(d, "dddd"))
You can also get the numeric day of the week using d.DayOfWeek.
In VB, try this:
DateTimePicker1.Value.DayOfWeek.ToString
it works
MsgBox(Now.Date.DayOfWeek.ToString)