a simple plugin to change date and time format
- parsing datetime to format global
 
go mod:
go get github.com/ibnusurkati/timeformatpackage main
import (
	"fmt"
	"github.com/ibnusurkati/timeformat"
)
func main() {
	// Get date  now
	DateNow()
	// Get date time now
	DateTimeNow()
	fmt.Println("===============================")
	// Parse date time
	ParseDateTime()
}
func DateNow() {
	date := timeformat.Now("YYYY-MM-DD")
	fmt.Println("DATE :", date)
}
func DateTimeNow() {
	datetime := timeformat.Now("YYYY-MM-DD hh:mm:ss")
	fmt.Println("DATETIME :", datetime)
}
func ParseDateTime() {
	datetime, err := timeformat.Parse("2021-09-13", "YYYY-MM-DD", "DD MMMM YYYY")
	if err != nil {
		fmt.Println("ERROR :", err)
		return
	}
	fmt.Println("DATETIME :", datetime)
}| Format | Format Go-Language | Description | 
|---|---|---|
| hh | 15 | 24-hour format of an hour with leading zeros | 
| h | 3 | 12-hour format of an hour without leading zeros | 
| mm | 04 | Minutes with leading zeros | 
| m | 4 | Minutes without leading zeros | 
| sss | 05 | Seconds with milliseconds | 
| ss | 05 | Seconds with leading zeros | 
| s | 5 | without with leading zeros | 
| A | PM | Uppercase Ante meridiem and Post meridiem | 
| a | pm | Lowercase Ante meridiem and Post meridiem | 
| Format | Format Go-Language | Description | 
|---|---|---|
| YYYY | 2006 | A full numeric representation of a year, 4 digits | 
| YY | 06 | A two digit representation of a year | 
| MMMM | January | A full textual representation of a month, such as January or March | 
| MMM | Jan | A short textual representation of a month, three letters | 
| MM | 01 | Numeric representation of a month, with leading zeros | 
| M | 1 | Numeric representation of a month, without leading zeros | 
| DDDD | Monday | A full textual representation of the day of the week | 
| DDD | Mon | A textual representation of a day, three letters | 
| DD | 02 | Day of the month, 2 digits with leading zeros | 
| D | 2 | Day of the month without leading zeros |