Skip to content

Instantly share code, notes, and snippets.

@hygull
Created December 9, 2016 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hygull/fb240bfafbd2077b702f67280e8bd1f9 to your computer and use it in GitHub Desktop.
Save hygull/fb240bfafbd2077b702f67280e8bd1f9 to your computer and use it in GitHub Desktop.
Printing system time and its decoration created by hygull - https://repl.it/Eikz/1
/*
* Date of creation : 09/12/2016.
* Aim of program : To print the system time and decorate it.
* Go version : 1.7
* Coded by : Rishikesh Agrawani.
*/
package main
import "fmt"
import "time"
func main() {
t := time.Now()
fmt.Printf("\n\n%v and its type is %T", t, t) //Printing value and its type with format specifiers like %v and %T respectively
fmt.Printf("\n\n%v and its type is %T",t.String(),t.String())
tNew := t.String()[0:19]
fmt.Printf("\n\n%v and its type is %T",tNew,tNew) //Slicing a time string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment