time_test.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package common
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. func TestTime2Second(t *testing.T) {
  7. t.Log(Time2Second(time.Now()))
  8. }
  9. func TestTime2StdString(t *testing.T) {
  10. t.Log(Time2StdString(time.Now()))
  11. }
  12. func TestGetTimeYesterday(t *testing.T) {
  13. t.Log(GetTimeYesterday().Format(FromatTime_V1))
  14. }
  15. func TestSecond2Time(t *testing.T) {
  16. t.Log(Second2Time(GetCurrentSeconds()).Format(FromatTime_V1))
  17. }
  18. func TestGetCurrentSeconds(t *testing.T) {
  19. t.Log(GetCurrentSeconds())
  20. }
  21. func TestTimeIsZero(t *testing.T) {
  22. t.Log(TimeIsZero(time.Time{}))
  23. }
  24. func TestGetTimeStart(t *testing.T) {
  25. t.Log(GetTimeStart(time.Now()).Format(FromatTime_V1))
  26. }
  27. func TestStringStd2Time(t *testing.T) {
  28. t.Log(StringStd2Time("2020-10-11 10:24:00").Format(FromatTime_V1))
  29. }
  30. // 11-24
  31. func TestGetTomorrow(t *testing.T) {
  32. t.Log(GetTomorrow(time.Now()).Format(FromatTime_V1))
  33. }
  34. // 11-24
  35. func TestGetYesterday(t *testing.T) {
  36. t.Log(GetYesterday(time.Now()).Format(FromatTime_V1))
  37. }
  38. func TestNewTimeWithYearAndMonthAndDay(t *testing.T) {
  39. t.Log(NewTimeWithYearAndMonthAndDay(2020, 10, 35).Format(FromatTime_V1))
  40. }