question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2012-12-31 in Powershell 7.1.1 still gives week 53 should be 1 When using: Calendar.GetWeekOfYear

See original GitHub issue

2012-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:closed
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
daxian-dbwcommented, Feb 4, 2021

@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.

<div> GitHub</div><div>dotnet/runtime</div><div>.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps. - dotnet/runtime</div>
1reaction
KalleOlaviNiemitalocommented, Feb 4, 2021

What is the UICulture, then? If it is U.S. English, then perhaps it is correct to use non-ISO week numbers there.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found