default_test.go 384 B

1234567891011121314151617181920
  1. package test
  2. import (
  3. "fmt"
  4. "github.com/astaxie/beego/cache"
  5. _ "github.com/astaxie/beego/cache/redis"
  6. "testing"
  7. "time"
  8. )
  9. var Cache cache.Cache
  10. func TestBeego(t *testing.T) {
  11. dd, _ := time.ParseDuration(fmt.Sprintf("-%dh", 24*30*1))
  12. dd1 := time.Now().Add(dd)
  13. println(int(dd1.Month()))
  14. xx := fmt.Sprintf("warning_%d_%02d", int(dd1.Year()), int(dd1.Month()))
  15. println(xx)
  16. }