Getting the day of the date

I have a number of dates formatted as:

03/26/1992
06/12/2010
01/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.

+6
date
source share
10 answers

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 
+7
source share

You want to see format strings for the ToString method. MyDate.ToString("dddd") will provide you with what you want.

+5
source share
 DateTime.Parse("2010/12/31").dayofweek 
+2
source share
 'Declaration <SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public Class ArgumentOutOfRangeException Inherits ArgumentException Implements ISerializable 'Usage Dim instance As ArgumentOutOfRangeException 
+1
source share

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

+1
source share

See the documentation for DateTime members. Parse, TryParse, DayOfWeek and ToString.

0
source share

Try

 dateValue.DayOfWeek.ToString() 
0
source share

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.

0
source share

In VB, try this:

 DateTimePicker1.Value.DayOfWeek.ToString 

it works

0
source share
 MsgBox(Now.Date.DayOfWeek.ToString) 
-2
source share

All Articles