How can I display a string like :
Wednesday is the 5th day week of week number in 2007
?
Is that even possible?
Printable View
How can I display a string like :
Wednesday is the 5th day week of week number in 2007
?
Is that even possible?
OK, figured out how to show the week number.
How can I show today's name, IOW, Wednesday ?Code:Dim sWeekOfYear As Integer = D.DayOfYear
Dim sWeek As Integer = (sWeekOfYear / 7)
Label9.Text = "Week " & sWeek.ToString
Date.Today.DayOfWeek.ToString()
Also, note that, by many people's standards, the first week of the year is not simply the first 7 days. The first week of the year might have less than 7 days and it might start after the first of January, going by normal standards. Check out the CalendarWeekRule enumeration for more info.
Thanx for the info!
I get week number 19, so it seems to be correct.
One last question here, how do I display 'May' instead of 5 ?
Figured out how to display 'May' :
Isn't there an easier way?Code:Microsoft.VisualBasic.DateAndTime.MonthName(number)
I gess:
but i wasn't able to test/try it.Code:Date.Today.Month.ToString()
Thanx, but that still shows 5
If you want to format a date you use it's ToString method. "d" is for day, "M" is for month and "y" is for year. Where day and month is concerned you can specify 1, 2, 3 or 4 characters. 1 character is single digit, 2 characters is double digit (leading zero), 3 characters is abbreviated name and 4 characters is full name, e.g.displays "Saturday, 12 May 2007".vb Code:
MessageBox.Show(Date.Today.ToString("dddd, d MMMM yyyy"))
All this is in the MSDN library and if you'd searched for date format you'd have found it yourself.