Skip to content

pmalek-sumo/datetranslate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

datetranslate

This package aims to translate format strings between 2 timestamp formats:

How to use it

package main

import (
    "fmt"
    "time"

    "github.com/observiq/ctimefmt"
    "github.com/pmalek-sumo/datetranslate"
)

func main() {
    dateFormat, err := datetranslate.SimpleDateFormat2Ctimefmt("yyyy-MM-dd HH:mm:ss.SSS")
    if err != nil {
        fmt.Printf("Couldn't translate provided format string: %v", err)
        return
    }

    out, err := ctimefmt.Format(dateFormat, time.Now())
    if err != nil {
        fmt.Printf("Couldn't format the time with ctimefmt: %v", err)
        return
    }

    fmt.Printf("The time is: %v", out)
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages