Golang time.Time.ISOWeek() function example
package time
Golang time.Time.ISOWeek() function usage example. Use in calculating the week number in a given year.
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
fmt.Println("Today : ", now.Format(time.ANSIC))
year, week := now.ISOWeek()
fmt.Printf("The ISO 8601 year is %d and week is %d \n", year, week)
}
Sample output :
Today : Fri Aug 7 13:42:24 2015
The ISO 8601 year is 2015 and week is 32
Reference :
Advertisement
Something interesting
Tutorials
+12k Golang : Clean formatting/indenting or pretty print JSON result
+10.5k Fix ERROR 1045 (28000): Access denied for user 'root'@'ip-address' (using password: YES)
+5.4k Python : Delay with time.sleep() function example
+12.3k Golang : Display list of countries and ISO codes
+9.3k Android Studio : Indicate progression with ProgressBar example
+8.8k Golang : HTTP Routing with Goji example
+5.6k Unix/Linux : How to find out the hard disk size?
+5.4k Javascript : How to loop over and parse JSON data?
+22k Golang : Join arrays or slices example
+25.4k Golang : Generate MD5 checksum of a file
+31.1k Golang : Calculate percentage change of two values
+5.2k Golang : Customize scanner.Scanner to treat dash as part of identifier