Skip to content

Releases: guobinhit/timekit

Release 1.1.1

06 May 03:24
Compare
Choose a tag to compare

Add two parse timestamp method, such as:

  • ParseTimestampUnix, parse unix timestamp to time.Time object;
  • ParseTimestampUnixMilli, parse unix milli timestamp to time.Time object.

Release 1.1.0

21 Sep 09:58
Compare
Choose a tag to compare

Supply a time toolkit names timekit. Using timekit, you can get some pratical functions.

Basic

  • add times with days, such as GetTimeAddDays, if param of d is 2022-04-13 10:20:30, then GetTimeAddDays(5) return 2022-04-18 10:20:30.
  • add times with hours, such as GetTimeAddHorus, if param of d is 2022-04-13 10:20:30, then GetTimeAddHorus(5) return 2022-04-13 15:20:30.
  • Similarly, if we set params is negative, the result is to subtract the corresponding time.

Format

  • format a time value to string, such as FormatYyyyMmDdHhMmSs, if param of d is 2022-04-13 10:20:30, then FormatYyyyMmDdHhMmSs(d) return 2022-04-13 10:20:30.
  • format a time value to string, such as FormatCnYyyyMmDdHhMmSs, if param of d is 2022-04-13 10:20:30, then FormatCnYyyyMmDdHhMmSs(d) return 2022年04月13日 10:20:30.
  • format a time value to string, such as FormatEnYyyyMmDdHhMmSs, if param of d is 2022-04-13 10:20:30, then FormatEnYyyyMmDdHhMmSs(d) return 2022/04/13 10:00:00.
  • format a time value to string, such as FormatCptYyyyMmDdHhMmSs, if param of d is 2022-04-13 10:20:30, then FormatCptYyyyMmDdHhMmSs(d) return 20220413102030.

Parse

  • parse a string value to time, such as ParseYyyyMmDdHhMmSs, if param of d is 2022-04-13 10:20:30, then ParseYyyyMmDdHhMmSs(d) return 2022-04-13 10:20:30.
  • parse a string value to time, such as ParseCnYyyyMmDdHhMmSs, if param of d is 2022年04月13日 10:20:30, then ParseCnYyyyMmDdHhMmSs(d) return 2022-04-13 10:20:30.
  • parse a string value to time, such as ParseEnYyyyMmDdHhMmSs, if param of d is 2022/04/13 10:00:00, then ParseEnYyyyMmDdHhMmSs(d) return 2022-04-13 10:20:30.
  • parse a string value to time, such as ParseCptYyyyMmDdHhMmSs, if param of d is 20220413102030, then ParseCptYyyyMmDdHhMmSs(d) return 2022-04-13 10:20:30.

Release 1.0.0

04 Apr 10:02
Compare
Choose a tag to compare

DEPRECATED, PLEASE USE LATEST VERSION.