Post

GoLangGoLang

I
Irshad Mohammad

Posted on 4th March 2024|40 views

0
votes

Golang Time To String

What is time.Time.String() in Golang?

Answers
P
Anthony A

Posted on 4th March 2024

The Time.String() function in Go language is utilized to generate the time that is formatted by the assistance of that format string. Furthermore, this function is determined beneath the time package. Here, you require to import the "time" package to utilize those functions.

import (

    "fmt"

    "time"

)

  func main() {

  Time := time.Date(2019, 9, 10, 8, 45, 19, 0, time.UTC)

   t := Time.String()

   fmt.Printf("Time without nanoseconds is: %v\n", t)

}

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos