Created
December 9, 2016 01:48
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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