time.ParseError.Error() Function in Golang With Examples Last Updated : 21 Apr, 2020 Comments Improve Suggest changes Like Article Like Report In Go language, time packages supplies functionality for determining as well as viewing time. The ParseError.Error() function in Go language is used to output the string description of a ParseError. Moreover, this function is defined under the time package. Here, you need to import "time" package in order to use these functions. Syntax: func (e *ParseError) Error() string Here, "e" is the pointer to ParseError, And ParseError is used to explain a problem that parses a time string. Return Value: It returns the string representation of a ParseError. Example 1: C // Golang program to illustrate the usage of // time.ParseError() function // Including main package package main // Importing fmt and time import "fmt" import "time" // Calling main func main() { // Declaring a struct // type ParseError // with its values error := time.ParseError{ Value: "1122020", Message: " There is an error!", } // Calling Error method // and printing string // representation of ParseError fmt.Println(error.Error()) } Output: parsing time "1122020" There is an error! Here, the string representation of Value and Message in struct type ParseError is returned. Example 2: C // Golang program to illustrate the usage of // time.ParseError() function // Including main package package main // Importing fmt and time import "fmt" import "time" // Calling main func main() { // Declaring a struct // type ParseError // with its values error := time.ParseError{ Layout: "2001 12 01", Value: "11:34:09", ValueElem: "11", Message: " An error occurred!", } // Calling Error method // and printing string // representation of ParseError fmt.Println(error.Error()) } Output: parsing time "11:34:09" An error occurred! It is the same as the above example but here more values are used in the ParseError struct type. Comment More infoAdvertise with us Next Article time.ParseError.Error() Function in Golang With Examples nidhi1352singh Follow Improve Article Tags : Go Language GoLang-time Similar Reads time.Parse() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Parse() function in Go language is used to parse a formatted string and then finds the time value that it forms. Moreover, this function is defined under the time package. Here, you need to import "time 2 min read time.ParseDuration() Function in Golang With Examples Go language provides inbuilt support for measuring and displaying time with the help of the time package. In this package, the calendrical calculations always assume a Gregorian calendar with no leap seconds. This package provides a ParseDuration() function which parses a duration string. Duration s 2 min read time.Sleep() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Sleep() function in Go language is used to stop the latest go-routine for at least the stated duration d. And a negative or zero duration of sleep will cause this method to return instantly. Moreover, t 3 min read time.Seconds() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Seconds() function in Go language is used to find the duration of time in the form of a floating-point number of seconds. Moreover, this function is defined under the time package. Here, you need to imp 2 min read time.Time.Before() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Time.Before() function in Go language is used to check if the stated time instant t is before the stated u or not. Moreover, this function is defined under the time package. Here, you need to import the 2 min read time.Since() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Since() function in Go language holds time value and is used to evaluate the difference with the actual time. Moreover, this function is defined under the time package. Here, you need to import the "tim 2 min read time.String() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The String() function in Go language is used to find a string that represents the duration formats as "24h6m0.7s". Here, the foremost zero units are deleted. And the stated duration with less than one-secon 2 min read time.Nanoseconds() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The Nanoseconds() function in Go language is used to find the duration of time in form of an integer nanosecond count. Moreover, this function is defined under the time package. Here, you need to import the 2 min read errors.New() Function in Golang with Examples Errors package in Golang is used to implement the functions to manipulate the errors. errors.New()function returns an error that formats like given text. Each call to New returns distinct error value indeed in the event that the content is indistinguishable. Syntax: func New(text string) error It re 1 min read time.NewTimer() Function in Golang With Examples In Go language, time packages supplies functionality for determining as well as viewing time. The NewTimer() function in Go language is used to create a new Timer that will transmit the actual time on its channel at least after duration "d". Moreover, this function is defined under the time package. 2 min read Like