https://github.com/guobinhit/timekit
♨️ A time toolkit written in Go.
https://github.com/guobinhit/timekit
date format now parse time
Last synced: about 1 year ago
JSON representation
♨️ A time toolkit written in Go.
- Host: GitHub
- URL: https://github.com/guobinhit/timekit
- Owner: guobinhit
- License: mit
- Created: 2023-03-26T02:11:37.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-06T03:24:01.000Z (about 2 years ago)
- Last Synced: 2025-04-06T16:40:44.446Z (about 1 year ago)
- Topics: date, format, now, parse, time
- Language: Go
- Homepage: https://guobinhit.github.io/timekit/
- Size: 28.3 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# timekit
[](https://github.com/guobinhit/timekit/actions/workflows/go.yml)
# Contributing
Contributions are very welcome!
If you see a problem that you'd like to see fixed, the best way to make it happen is to help out by submitting a pull request implementing it. Refer to the [CONTRIBUTING.md](../master/CONTRIBUTING.md) file for more details about the workflow.
You can also ask for problem-solving ideas and discuss in GitHub issues directly.
# Usage
Firstly, download this pkg,
```go
go get github.com/guobinhit/timekit
```
Secondly, use it.
```go
import (
"github.com/guobinhit/timekit"
)
// Get a specified time by add days, such as d is 2022-04-13 10:20:30 and days is 10,
// then aDate is 2022-04-23 10:20:30
aDate := timekit.GetTimeAddDays(time.Now(), 10)
// Get a specified date format time string of common version, such as d is 2022-04-13 10:20:30,
// then aString is "2022-04-23 10:20:30"
aString := timekit.FormatYyyyMmDdHhMmSs(time.Now())
// Get a specified date format time string of china version, such as d is 2022-04-13 10:20:30,
// then aString2 is "2022年04月23日 10:20:30", like FormatCnOfYyyyMmDdHhMmSs method,
// FormatEnOfYyyyMmDdHhMmSs return "2022/04/23 10:20:30" and FormatCptOfYyyyMmDdHhMmSs return "20220423102030".
aString2 := timekit.FormatCnOfYyyyMmDdHhMmSs(time.Now())
// Get a specified date format time, such as dStr is "2022-04-13 10:20:30",
// then aTime is 2022-04-23 10:20:30
aTime, err := timekit.ParseYyyyMmDdHhMmSs("2022-04-13 10:20:30")
```
Finally, good luck guys!