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
+18.4k Golang : Aligning strings to right, left and center with fill example
+6.5k Golang : How to determine if request or crawl is from Google robots
+8.1k Golang : Reverse text lines or flip line order example
+55.1k Golang : Unmarshal JSON from http response
+8.3k Golang : Generate Datamatrix barcode
+6.8k Golang : Pat multiplexer routing example
+18.5k Golang : Generate thumbnails from images
+17.5k Golang : Parse date string and convert to dd-mm-yyyy format
+6.9k Golang : Takes a plural word and makes it singular
+10.8k Golang : How to transmit update file to client by HTTP request example
+5.6k Fix yum-complete-transaction error
+23.4k Golang : Check if element exist in map