Standard library / time
time.Time.IsDST()
Report whether daylight saving is active in the associated location at this instant. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (t Time) IsDST() boolReturn Value
bool
Report whether daylight saving is active in the associated location at this instant.
Working Example
Example Snippetgo
package main
import ( "fmt" "time" _ "time/tzdata")
func must(err error) { if err != nil { panic(err) }}func main() { loc, err := time.LoadLocation("Europe/Stockholm") must(err) fmt.Println(time.Date(2024, 7, 1, 12, 0, 0, 0, loc).IsDST())}