Standard library / archive/zip
archive/zip.FileHeader.SetModTime()
Deprecated setter for modification time and legacy DOS fields. Prefer assigning Modified. Expected stdout: '2024\n'.
Formal Syntax & Structure
go syntaxgo
func (h *FileHeader) SetModTime(t time.Time)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| t | time.Time | Modification timestamp. |
Working Example
Example Snippetgo
package main
import ( "archive/zip" "fmt" "time")
func must(e error) { if e != nil { panic(e) }}
func main() { h := zip.FileHeader{} h.SetModTime(time.Date(2024, 1, 2, 3, 4, 6, 0, time.UTC)) fmt.Println(h.Modified.Year())}