github.com/chain5j/chain5j-pkg@v1.0.7/util/dateutil/pretty_test.go (about)

     1  // Package dateutil
     2  //
     3  // @author: xwc1125
     4  package dateutil
     5  
     6  import (
     7  	"testing"
     8  	"time"
     9  )
    10  
    11  func TestPrettyAge_String(t *testing.T) {
    12  	t.Log("ms", time.Now().UnixMilli())
    13  	t.Log("s", time.Now().Unix())
    14  	millisecondToTime := MillisecondToTime(1635050328000)
    15  	t.Log("ms", millisecondToTime.UnixMilli())
    16  	distanceTime := GetDistanceTime(1)
    17  	t.Log(distanceTime)
    18  	t.Log(Format(millisecondToTime, Default))
    19  	age := PrettyAge(millisecondToTime)
    20  	t.Log(age.String())
    21  	duration := PrettyDuration(time.Since(millisecondToTime))
    22  	t.Log(duration.String())
    23  }