Format a Go time value using the reference time string Mon Jan 2 15:04:05 MST 2006 with the Format method.
Use the time.Time.Format method with the reference time string "Mon Jan 2 15:04:05 MST 2006" to format a time value. Replace the specific parts of the reference time with your desired format layout.
import "time"
now := time.Now()
formatted := now.Format("Mon Jan 2 15:04:05 MST 2006")
Go formats dates using a specific example date instead of symbols like 'YYYY' or 'MM'. You tell the computer what the date looks like by showing it the exact format you want using the date January 2, 2006, at 3:04:05 PM. It's like giving a template photo to a printer so it knows exactly how to arrange the text.