我想要获得当月的第一天和最后一天.您可以添加日期和小时但不是月份,我想从下个月减去一天以获得本月的最后一天.像这样的东西:
package main
import (
"fmt"
"time"
)
func main() {
date := time.Now()
nextMonth := date.Add(time.Month)
LastDay := nextMonth.Add(-time.Hour * 24)
fmt.Println(LastDay)
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Revel作为一个小应用程序并添加了SSL.当我将配置更新为指向http.port = 443时,对端口80的请求将被拒绝而不是被转发.有没有办法在Revel框架上解决这个问题?谢谢.
# The port on which to listen.
http.port = 443
# Whether to use SSL or not.
http.ssl = true
# Path to an X509 certificate file, if using SSL.
http.sslcert = /root/go/src/saml/AlphaCerts/cert.crt
# Path to an X509 certificate key, if using SSL.
http.sslkey = /root/go/src/saml/star_home_com.key
Run Code Online (Sandbox Code Playgroud) 在python中,你可以获取一个json对象并从中获取一个特定项而不声明一个结构,保存到一个结构然后获取像Go中的值.是否有一个包或更简单的方法来存储Go中的json特定值?
蟒蛇
res = res.json()
return res['results'][0]
Run Code Online (Sandbox Code Playgroud)
走
type Quotes struct {
AskPrice string `json:"ask_price"`
}
quote := new(Quotes)
errJson := json.Unmarshal(content, "e)
if errJson != nil {
return "nil", fmt.Errorf("cannot read json body: %v", errJson)
}
Run Code Online (Sandbox Code Playgroud)