Change-Id: Id22d199ea4b0a9795dc3d9e5f7a74be13ff0cf58
Reviewed-on: https://go-review.googlesource.com/c/go/+/618755
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
"log"
"net/mail"
"strings"
+ "time"
)
func ExampleParseAddressList() {
// Subject: Gophers at Gophercon
// Message body
}
+
+func ExampleParseDate() {
+ dateStr := "Wed, 09 Oct 2024 09:55:06 -0700"
+
+ t, err := mail.ParseDate(dateStr)
+ if err != nil {
+ log.Fatalf("Failed to parse date: %v", err)
+ }
+
+ fmt.Println(t.Format(time.RFC3339))
+
+ // Output:
+ // 2024-10-09T09:55:06-07:00
+}