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
+6.5k How to let Facebook Login button redirect to a particular URL ?
+5.5k Unix/Linux : How to test user agents blocked successfully ?
+8.9k Golang : Generate Codabar
+6.9k Nginx : How to block user agent ?
+5.5k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+4.8k Swift : Convert (cast) Float to Int or Int32 value
+17.2k Golang : Clone with pointer and modify value
+13.3k Golang : reCAPTCHA example
+5.7k Golang : Function as an argument type example
+18.1k Golang : Aligning strings to right, left and center with fill example
+16.5k Golang : Fix cannot convert buffer (type *bytes.Buffer) to type string error
+24.2k Golang : Change file read or write permission example