greyseal,
Your code converted to VB.NET produces:
dateBack "Friday, June 11, 2004 (163)" String
Under VB.NET 2003 on Windows XP Pro with regional settings for the U.S.
Dim myCal As Calendar = CultureInfo.InvariantCulture.Calendar
Dim theDate As DateTime = New DateTime(DateTime.Now.Year,
DateTime.Now.Month, DateTime.Now.Day, New GregorianCalendar)
Dim dateBack As String = theDate.ToString("D") + " (" +
myCal.GetDayOfYear(theDate).ToString() + ")"
Just curious why do you get the InvariantCulture's Calendar then pass New
GregorianCalendar to DateTime? I would expect you should use the same
calendar in both cases!
Hope this helps
Jay
"greyseal" <gr*************@hotmail.com> wrote in message
news:ee**************************@posting.google.c om...
Consider the following:
As I post this, it is June 11th, 2004.
My desk calendar tells me it is day 163 of the current year.
This code:
Calendar myCal = CultureInfo.InvariantCulture.Calendar;
DateTime theDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month,
DateTime.Now.Day, new GregorianCalendar() );
string dateBack = theDate.ToString("D") + " (" +
myCal.GetDayOfYear(theDate).ToString() + ")";
returns Friday, June 11, 2004 (150)
Obviously, the day of the year is incorrect. What am I doing wrong?
TIA.
greyseal