times.go 432 B

12345678910111213141516171819
  1. package times
  2. import (
  3. "time"
  4. ctime "github.com/cherry-game/cherry/extend/time"
  5. )
  6. func MillisToDatetimeFormat(timestamp int64) string {
  7. return ctime.CreateFromTimestamp(timestamp).ToDateTimeFormat()
  8. }
  9. func SecondToDatetimeFormat(seconds int64) string {
  10. return MillisToDatetimeFormat(seconds * 1000)
  11. }
  12. func ParseDateFormat(date string) (time.Time, error) {
  13. return time.ParseInLocation(ctime.DateFormat, date, time.Local)
  14. }