Go-carbon v2.0.0 was released and needed go version >= 1.16

Carbon is a simple, semantic and developer-friendly golang package for datetime.

Carbon has been included by awesome-go , if you think it is helpful, please give me a star.



Go version < 1.16
go get -u github.com/golang-module/carbon

import (
Go version >= 1.16
go get -u github.com/golang-module/carbon/v2

import (
Change log
  • Golang version must be upgraded to 1.16 at least. Using the ‘embedded’ feature, there is no need to copy the Lang language directory to the current project
  • The public field time in the carbon structure is changed to the private field time
  • Remove the totimestamp() method, leaving only the timestamp() method
  • Remove the totimestampwithsecond() method, leaving only the timestampwithsecond() method
  • Remove the totimestampwithmilliseconds() method, leaving only the timestampwithmilliseconds() method
  • Remove the totimestampwithmicrosecond() method, leaving only the timestampwithmicrosecond() method
  • Remove the totimestampwithnanosecond() method, leaving only the timestampwithnanosecond() method
  • Remove the totimestamp structure, leaving only the timestamp structure
  • Remove the totimestampwithsecond structure, leaving only the timestampwithsecond structure
  • Remove the totimestampwithmilliseconds structure, leaving only the timestampwithmilliseconds structure
  • Remove the totimestampwithmicrosecond structure, leaving only the timestampwithmicrosecond structure
  • Remove the totimestampwithnanosecond structure, leaving only the totimestampwithnanosecond structure
  • Remove the todatetimestring structure, leaving only the datetime structure
  • Remove todatetimestring structure and only keep date structure
  • Remove the totimestring structure, leaving only the time structure