如何格式化今天的日期为dd-mm-yyyy? [重复]

This question already has an answer here:

I am trying to format todays date in golang and seem to be struggling with something i deem to be quite simple.

I am trying to get todays date in the format of dd-mm-yyy

any ideas?

thanks

</div>

It works this way in Go Playground: https://play.golang.org/p/kBjTxZS9Y7

Here is the code:

package main

import (
    "fmt"
    "time"
)

func main() {
    fmt.Println(time.Now().Format("02-01-2006"))
}