https://github.com/nhatthm/timeparser
Time parser for Golang
https://github.com/nhatthm/timeparser
go golang parser time timeparser
Last synced: 7 months ago
JSON representation
Time parser for Golang
- Host: GitHub
- URL: https://github.com/nhatthm/timeparser
- Owner: nhatthm
- License: mit
- Created: 2021-04-16T12:46:07.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-13T22:35:31.000Z (11 months ago)
- Last Synced: 2025-04-06T03:31:44.482Z (10 months ago)
- Topics: go, golang, parser, time, timeparser
- Language: Go
- Homepage:
- Size: 54.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Time Parser for Golang
[](https://github.com/nhatthm/timeparser/releases/latest)
[](https://github.com/nhatthm/{}name/actions/workflows/test.yaml)
[](https://codecov.io/gh/nhatthm/timeparser)
[](https://goreportcard.com/report/go.nhat.io/timeparser)
[](https://pkg.go.dev/go.nhat.io/timeparser)
[](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)
`timeparser` provides flexibility in parsing time from string for Golang. It allows either `RFC3339` or `YMD`.
## Prerequisites
- `Go >= 1.17`
## Install
```bash
go get go.nhat.io/timeparser
```
## Usage
### `func Parse(s string) (time.Time, error)`
Parse a time in `string` to `time.Time`. `s` could be `RFC3339` or `YMD`.
### `func ParsePeriod(from, to string) (start *time.Time, end *time.Time, err error)`
Parse a time period from `string` to `time.Time`.
`from` and `to` could be `RFC3339` or `YMD`. It is `nil` if the string is empty.
## Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
### Paypal donation
[](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)
or scan this