What is the .net equivalent of the Oracle to_char(date, “IW”) function (returns the week number). I tried using CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday) but some results don’t match. Not really sure what values I should pass for the CalendarWeekRule and DayOfWeek enums.
What is the .net equivalent of the Oracle to_char(date, IW) function (returns the week
Share
It looks like Oracle uses the ISO-8601 definition of “week of year” which isn’t quite supported by .NET out of the box. However, this blog post gives some alternative code you could use to fudge it.
As an aside, I’d be interested to know whether my Noda Time project gives you the right results (you could always use that instead of
DateTime🙂 – if you can give some sample input, Oracle output and .NET output (particularly where they differ) that would be useful to me.