Golang time.Now(), Date() functions and time.Time type example
package time
Golang time.Now(), Date() functions and time.Time type usage example
package main
import (
"fmt"
"time"
)
func main() {
Imanojikan := time.Now()
fmt.Println(Imanojikan)
year, month, day := time.Now().Date()
fmt.Println("Year : ", year)
fmt.Println("Month : ", month)
fmt.Println("Day : ", day)
}
Output :
2015-08-03 13:50:59.495389805 +0800 MYT
Year : 2015
Month : August
Day : 3
References :
http://golang.org/pkg/time/#Now
Advertisement
Something interesting
Tutorials
+36.5k Golang : Save image to PNG, JPEG or GIF format.
+7.3k Golang : alternative to os.Exit() function
+5.9k Golang : Use NLP to get sentences for each paragraph example
+23.1k Golang : Randomly pick an item from a slice/array example
+4.6k MariaDB/MySQL : How to get version information
+5k Google : Block or disable caching of your website content
+16.4k Golang : Convert slice to array
+12k Golang : Decompress zlib file example
+5.5k Golang : Stop goroutine without channel
+6.3k Unix/Linux : Use netstat to find out IP addresses served by your website server
+5.4k Gogland : Datasource explorer
+21.8k Golang : Upload big file (larger than 100MB) to AWS S3 with multipart upload