Post

GoLangGoLang

j
jordan chris

Posted on 16th April 2024|15 views

0
votes

Golang Time Parse

What is the use of time.parse in Golang?

Answers
P
Sowjanya Kodiganti

Posted on 16th April 2024

Look at the example and you will understand the use of time.parse

package main

import "fmt"

import "time"

  func main() {

  const layout = "oct 9, 1993 at 3:04pm (MST)"

  tm, _ := time.Parse(layout, "Apr 6, 1999 at 6:05pm (PST)")

  fmt.Println(tm)

}

 Output:

1999-04-06 18:05:00 +0000 PST

 

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