Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DayOfWeek as String 1

Status
Not open for further replies.

IlyaRabyy

Programmer
Joined
Nov 9, 2010
Messages
572
Location
US
Colleagues,
The code below shows me the numeric (Int) sequential number of the day (in this case - Friday):
Code:
Dim ldToday As Date = Today, ldLastWeek As Date = ldToday.AddDays(-7), lcDate As String = ldLastWeek.ToString(Format("d")), _
    lcFriday As String = "", ldFriday As Date = ldLastWeek
'MsgBox("Today: " & ldToday.ToString("d") & vbCrLf & "Last week: " & ldLastWeek.ToString("d") & vbCrLf & lcDate)
Do While ldFriday.DayOfWeek < DayOfWeek.Friday
   ldFriday = ldFriday.AddDays(1)
Loop

MsgBox(ldFriday.DayOfWeek)

I cannot find how to convert it into the String (s./b. "Friday") - HOW-TO?
TIA!

Regards,

Ilya
 
Hi,
Code:
Module Module1
    Sub Main()
        ' Use current time.
        ' ... Use a format.
        ' ... Write to console.
        Dim time As DateTime = DateTime.Now
        Dim format As String = "dddd"     '... ddd==Mon, Tue... dddd==Monday, Tuesday...
        Console.WriteLine(time.ToString(format))
    End Sub
End Module


Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top