package main import ( "fmt" "time" ) func main() { t := time.Now() year, week := t.ISOWeek() fmt.Printf("Year: %d, Week: %d\n", year, week) }
package main import ( "fmt" "time" ) func main() { t := time.Date(2022, time.January, 1, 0, 0, 0, 0, time.UTC) year, week := t.ISOWeek() fmt.Printf("Year: %d, Week: %d\n", year, week) }In this example, we are creating a `time.Time` object with a specific date and time (January 1st, 2022, at midnight UTC). We then call the `ISOWeek()` method to retrieve the ISO week date, which should be the first week of the year 2022. Finally, we print the results to the console.