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
+4.5k Facebook : How to place save to Facebook button on your website
+22.1k Golang : Read directory content with filepath.Walk()
+9.9k Golang : Get login name from environment and prompt for password
+8.6k Golang : Gorilla web tool kit schema example
+11.3k Golang : Change date format to yyyy-mm-dd
+15.2k Golang : invalid character ',' looking for beginning of value
+8.3k Linux/Unix : fatal: the Postfix mail system is already running
+6.4k Golang : Embedded or data bundling example
+16.2k CodeIgniter/PHP : Create directory if does not exist example
+8.4k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+11.3k Swift : Convert (cast) Float to String
+33.7k Golang : Call a function after some delay(time.Sleep and Tick)