V
V
v- death2015-11-08 04:55:40
go
v- death, 2015-11-08 04:55:40

How to specify Expires in a cookie?

cookie := &http.Cookie{
    Name:    "timestamp",
    Value:   strconv.FormatInt(time.Now().Unix(), 10),
    Expires: ,
  }
  http.SetCookie(w, cookie)

Says that Expires should be time.Time I googled for a long time and did not get a clear answer. Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-11-08
@vGrabko99

a cookie for a day:
well, of course:
PS you are either lazy or banned in Google: I don’t understand how you can not find https://golang.org/pkg/time/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question