package main
import (
"fmt"
"time"
)
var t time.Time
var dt time.Time
var dt2 string
func dt_time() (string) {
dt = time.Now()
dt2 = dt.Format("09.05.2006")
return dt2
}
func main() {
dt_time()
fmt.Println("dt2:", dt2)
t = time.Now()
fmt.Println("t #1:", t.Format("09.05.2006"))
fmt.Println("t #2:", t.String())
fmt.Println("t #3:", t)
}
// Выводит:
// dt2: 09.00.2009
// t #1: 09.00.2009
// t #2: 2009-11-10 23:00:00 +0000 UTC m=+0.000000001
// t #3: 2009-11-10 23:00:00 +0000 UTC m=+0.000000001