github.com/coreservice-io/utils@v0.3.0/time_util/utc.go (about)

     1  package time_util
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  )
     7  
     8  func GetUTCDate() string {
     9  	now := time.Now().UTC()
    10  	return fmt.Sprintf("%d-%02d-%02d", now.Year(), now.Month(), now.Day())
    11  }
    12  
    13  func GetUTCDateTime() string {
    14  	now := time.Now().UTC()
    15  	return fmt.Sprintf("%d-%02d-%02d %02d:%02d:%02d", now.Year(), now.Month(), now.Day(),
    16  		now.Hour(), now.Minute(), now.Second())
    17  }