Standard library / time
time.ParseError.Error()
Format the parsing failure diagnostic. Use errors.As for structured access; avoid depending on exact diagnostic wording. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (e *ParseError) Error() stringReturn Value
string
Format the parsing failure diagnostic.
Working Example
Example Snippetgo
package main
import ( "fmt" "time")
func main() { _, err := time.Parse(time.DateOnly, "not-a-date") e, ok := err.(*time.ParseError) fmt.Println(ok && e.Error() != "")}