LoginSignup
0
0

More than 5 years have passed since last update.

PHPの月日数(月末日)をgolangで実装

Last updated at Posted at 2018-11-15

PHPの月日数(月末日)をgolangで実装する

date.php
$d = date('t');
echo $d
date.go
package main

import (
    "fmt"
    "time"
)

func main() {
    t1 := time.Now()
    t2 := time.Date(t1.Year(), t1.Month(), 1, 0, 0, 0, 0, time.Local).AddDate(0, 1, 0)
    d := time.Date(t2.Year(), t2.Month(), 0, 0, 0, 0, 0, time.Local)
    fmt.Println(d.Day())
}
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0