SherryTime is a time utility package written in Go. It provides a simple API for handling time zones, time formatting, UUID generation, and more.
Install using go get:
go get github.com/asccclass/sherrytimeIf you want to use the UUID feature, also install:
go get github.com/google/uuidpackage main
import (
"fmt"
"log"
"github.com/asccclass/sherrytime"
)
func main() {
// Initialize SherryTime with time zone Asia/Taipei and date-time separator "-"
st := sherrytime.NewSherryTime("Asia/Taipei", "-")
// Get current time
log.Printf("Current Time: %v", st.Now())
// Get today's date
fmt.Println("Today's Date:", st.Today())
// Generate a new UUID
fmt.Println("Generated UUID:", st.NewUUID())
}Run tests using Makefile:
make test| Function Name | Return Type | Description |
|---|---|---|
Today() |
string |
Get today's date |
Now() |
string |
Get current time |
NewUUID() |
string |
Generate a new UUID |
| File Name | Description |
|---|---|
sherrytime.go |
Main feature implementation |
sherrytime_test.go |
Unit tests |
sherrytimeformat.go |
Time formatting functions |
sherrytimegoogle.go |
Google-related time features |
sherrytimenanoid.go |
Generate unique ID using NanoID |
sherrytimeuuid.go |
Generate unique ID using UUID |
hseb.go |
Additional helper functions |
makefile |
Automation scripts for build/test |
This project is licensed under the MIT License.
Developed and maintained by LIU CHIH HAN (asccclass).
For more information, visit the asccclass page.