Click here to Skip to main content
16,014,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

can you advice me, how to find day from any date using array in vb.net code.

Thanks
Refeesh
Posted
Comments
Amir Mahfoozi 20-Dec-11 8:23am    
Give a sample input and output to clarify.

Why would you use an array? Just create it as a DateTime, and it will give you (nearly) all the information you could want:
VB
Dim dt As DateTime = DateTime.Parse("20/12/2011")
Console.WriteLine(dt.DayOfWeek)
 
Share this answer
 
Comments
Refeesh 21-Dec-11 2:57am    
advice me any other idea
OriginalGriff 21-Dec-11 3:13am    
Why?
That one works, and is not restricted to a single language - it will return a day of the week name in the users current language and culture.
If you implement it yourself, I suspect you will miss some languages completely.
Do not re-invent the wheel - if a library method exists, use it!
i applied in array to find dayname.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim daydply As String = ""
Dim arr(6) As String
arr(0) = "Sunday"
arr(1) = "Monday"
arr(2) = "Thuesday"
arr(3) = "Wednesday"
arr(4) = "Thursday"
arr(5) = "Friday"
arr(6) = "Saturday"

Dim dt As DateTime = DateTime.Parse("28/02/2011")
daydply = (dt.DayOfWeek)

TextBox1.Text = arr(daydply)

End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900