2012-12-31 in Powershell 7.1.1 still gives week 53 should be 1 When using: Calendar.GetWeekOfYear
See original GitHub issue2012-12-31 in Powershell 7.1.1 still gives week 53 should be 1 When using:
(Get-Culture).Calendar.GetWeekOfYear('2012-12-31', (Get-Culture).DateTimeFormat.CalendarWeekRule, (Get-Culture).DateTimeFormat.FirstDayOfWeek)
The formula should be based on the number of Thursdays in THIS year and must be starting with a Thursday or a Wendsday( When this is a Leapyear.)
‘2012-01-01’ is a Sunday…?
Probably the issue exist because Sunday = 0 instead of Monday.
http://week-number.net/calendar-with-week-numbers-2012.html
<div>2012 calendar with Week Numbers - What week is it?</div>
_Originally posted by @B-Art in https://github.com/PowerShell/PowerShell/issues/11534#issuecomment-772867962_
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Powershell get week number from given date
i'm trying to get the week number from a given date within powershell ... %V "2021/01/01" returns week 1 when infact it is...
Read more >Get the ISO 8601 Week of Year of a given date in Powershell
Date 2012-12-31 should be week 1 but it gives 53. So you would have to implement some sort of solution to that. (Get-Culture).Calendar....
Read more >Get-Date - PowerShell
Week 1 is simply defined as the first 6 days of the year and subsequent weeks numbered every 7 days. Why 6 days...
Read more >How to install and upgrade to PowerShell 7.1
PowerShell 7 was designed to coexist with Windows PowerShell 5.1. PowerShell 7 installs to a new directory, enabling side-by-side execution.
Read more >PowerShell editing with Visual Studio Code
The Microsoft PowerShell extension for Visual Studio Code (VS Code) provides rich language support and capabilities such as syntax completions, definition ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@B-Art You are calling a .NET API
Calendar.GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek)
. If you have question about the behavior of that API, please open an issue in https://github.com/dotnet/runtime or post a question in their Discussions.What is the UICulture, then? If it is U.S. English, then perhaps it is correct to use non-ISO week numbers there.