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
+9.5k Golang : Find the length of big.Int variable example
+13.5k Golang : Verify token from Google Authenticator App
+18.5k Golang : Example for RSA package functions
+22.3k Golang : Securing password with salt
+6.6k PHP : Shuffle to display different content or advertisement
+19k Golang : Read input from console line
+8k Setting $GOPATH environment variable for Unix/Linux and Windows
+9k Golang : What is the default port number for connecting to MySQL/MariaDB database ?
+13.1k Golang : List objects in AWS S3 bucket
+12.4k Golang : Flush and close file created by os.Create and bufio.NewWriter example
+16.4k Golang :Trim white spaces from a string