Golang time.Time.Clock() function example
package time
Golang time.Time.Clock() function example usage example
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
fmt.Println("Today : ", now.Format(time.ANSIC))
hr, min, sec := now.Clock()
fmt.Printf("Clock : [%d]hour : [%d]minutes : [%d] seconds \n", hr, min, sec)
}
Sample output :
Today : Mon Aug 3 15:55:25 2015
Clock : [15]hour : [55]minutes : [25] seconds
Reference :
Advertisement
Something interesting
Tutorials
+7.7k Golang : Find network service name from given port and protocol
+3.8k Golang : Experimental Jawi programming language
+14.5k Golang : Read large file with bufio.Scanner cause token too long error
+17.5k Golang : Get host name or domain name from IP address
+11.2k Golang : Search and extract certain XML data example
+12.9k Golang : Google Drive API upload and rename example
+7.4k Golang : Add text to image and get OpenCV's X, Y co-ordinates example
+7k Findstr command the Grep equivalent for Windows
+12.7k Golang : Fix cannot use buffer (type bytes.Buffer) as type io.Writer(Write method has pointer receiver) error
+7.6k Golang : Convert(cast) []byte to io.Reader type
+26.8k Golang : Connect to database (MySQL/MariaDB) server
+3.9k PHP : Extract part of a string starting from the middle