package main
import (
"fmt"
"time"
)
func main(){
a := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
var b []int
windowSize := 2
for i, e := 0, true; e; i++ {
if windowSize < len(a) - windowSize * i {
b = a[windowSize * i:windowSize * (i + 1)]
} else {
b = a[windowSize * i:]
e = false
}
fmt.Println("b:", b)
}
jst
:= time.
FixedZone("Asia/Tokyo", 9*60*60)
fmt.
Println(time.
Date(2261, time.
December, 30, 23, 59, 59, 0, time.
UTC).
UnixNano())
fmt.
Println("Format RFC3339Nano", time.
Unix(0, 2057517719900000000).
In(jst
).
Format(time.
RFC3339Nano))
rfcTestTime
, err
:= time.
Parse(time.
RFC3339Nano, "2022-09-19T17:10:33.403859986+09:00") fmt.Println("Parse RFC3339Nano 2022-09-19T17:10:33.403859986+09:00: ", rfcTestTime.UnixNano(), err)
rfcTestTimeEmpty
, err
:= time.
Parse(time.
RFC3339Nano, "") fmt.Println("Parse RFC3339Nano empty: ", rfcTestTimeEmpty, err)
fmt.
Println("now", time.
Now().
UnixNano()) fmt.
Println("2261", time.
Date(2261, time.
December, 31, 23, 59, 59, 0, time.
UTC).
UnixNano()) fmt.
Println("aaaa", time.
Unix(0, 1730089828465717800).
In(jst
)) fmt.
Println("sdsd", time.
Unix(0, 1661180400000000000).
In(jst
)) fmt.
Println("bbbb", time.
Unix(0, 1661180400000000000).
In(jst
)) fmt.
Println("cdcd", time.
Unix(0, 1646060399999999999).
In(jst
)) fmt.
Println("vcvc", time.
Unix(0, 1682299800000000000).
In(jst
)) fmt.
Println("2024/04/08 --- ", time.
Date(2024, time.
Month(4), 8, 0, 0, 0, 0, jst
).
UnixNano()) fmt.
Println("2024/04/10 --- ", time.
Date(2024, time.
Month(4), 10, 0, 0, 0, 0, jst
).
UnixNano()) fmt.
Println("2022-12-01-STATEMENT", time.
Unix(0, 1669821042144608073).
In(jst
)) fmt.
Println("2022-12-01-STATUS", time.
Unix(0, 1672499460554471700).
In(jst
)) fmt.
Println("2022-12-02-STATEMENT", time.
Unix(0, 1672499466021016887).
In(jst
)) fmt.
Println("2022-12-02-STATUS", time.
Unix(0, 1672499466021016887).
In(jst
))
t
, _
:= time.
Parse("2006-01-02", "2022-04-01") fmt.Println(t.In(jst))
fmt.
Println("startDate 11/01", time.
Date(2022, time.
Month(11), 1, 0, 0, 0, 0, jst
).
UnixNano()) fmt.
Println("startDate 11/09", time.
Date(2022, time.
Month(11), 9, 0, 0, 0, 0, jst
).
UnixNano()) fmt.
Println("startDate 11/30", time.
Date(2022, time.
Month(11), 30, 0, 0, 0, 0, jst
).
UnixNano()) fmt.
Println("startDate 12/01", time.
Date(2022, time.
Month(12), 1, 0, 0, 0, 0, jst
).
UnixNano()) fmt.
Println("startDate 12/09", time.
Date(2022, time.
Month(12), 9, 0, 0, 0, 0, jst
).
UnixNano()) fmt.
Println("endDate 2023/08/24", time.
Date(2023, time.
Month(8), 24, 23, 59, 59, 999999999, jst
).
UnixNano()) fmt.
Println("endDate 2023/09/15(ms)", time.
Date(2023, time.
Month(9), 15, 23, 59, 59, 990000000, jst
).
UnixNano())
startOfApril
:= time.
Date(2022, time.
Month(4), 1, 0, 0, 0, 0, jst
) endOfApril
:= time.
Date(2022, time.
Month(4), 30, 23, 59, 59, 999999999, jst
)
fmt.Println("4/1", startOfApril)
fmt.Println("4/30", endOfApril)
fmt.Println(endOfApril.Day() - startOfApril.Day() + 1)
closingDate
:= time.
Date(2022, time.
Month(4), 20, 23, 59, 59, 999999999, jst
)
fmt.Println(closingDate.AddDate(0, 0, -(31 - 1)))
fmt.Println(0 / 31)
}
cGFja2FnZSBtYWluCmltcG9ydCAoCgkiZm10IgoJInRpbWUiCikKCmZ1bmMgbWFpbigpewoJYSA6PSBbXWludHswLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5LCAxMH0KCXZhciBiIFtdaW50Cgl3aW5kb3dTaXplIDo9IDIKCQoJZm9yIGksIGUgOj0gMCwgdHJ1ZTsgZTsgaSsrIHsKCQlpZiB3aW5kb3dT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