常用类型及数据操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
937 B

3 years ago
3 years ago
3 years ago
3 years ago
  1. package helper
  2. import (
  3. "testing"
  4. "time"
  5. // "time"
  6. )
  7. // func Test_FormatDate(t *testing.T) {
  8. // str := "1110"
  9. // strconv := FormatDate(str)
  10. // t.Log(strconv)
  11. // timing := "2019/1/1 8:28"
  12. // ret, err := time.ParseInLocation("2006/1/2 15:04", timing, time.Local)
  13. // t.Log(ret.Unix())
  14. // t.Log(err)
  15. // }
  16. // func Test_GetToadyStartTimeStamp(t *testing.T) {
  17. // t.Log(GetMonthStartTimeStamp())
  18. // }
  19. // func Test_RFC3339ToCSTLayout(t *testing.T) {
  20. // cur := "2018-06-08T10:34:56+08:00"
  21. // ret, err := RFC3339ToCSTLayout(cur)
  22. // t.Log(ret)
  23. // t.Log(err)
  24. // }
  25. func Test_GetTodayStartTimeStamp(t *testing.T) {
  26. reserve_date := "2023-05-15"
  27. reserveTime, err := time.ParseInLocation("2006-01-02", reserve_date, time.Local)
  28. if err != nil {
  29. t.Log("err:", err)
  30. }
  31. // 今天0点的时间戳
  32. t.Log(reserveTime.Unix())
  33. }
  34. func Test_DatetimeToUnix(t *testing.T) {
  35. date := "2023-09-01 00:00:00"
  36. t.Log(DatetimeToUnix(date))
  37. }