Fixed Datetime column values. Added utils.GetSQLiteFormattedDateTime def

This commit is contained in:
Paulo Truta
2021-05-30 11:28:42 +00:00
parent 81b545f868
commit 770e814b6e
2 changed files with 21 additions and 4 deletions
+10
View File
@@ -7,6 +7,7 @@ import (
"log"
"os"
"os/exec"
"time"
"github.com/joho/godotenv"
)
@@ -96,6 +97,15 @@ func GetSQLiteDbConnectionDetails() string {
}
// GetSQLiteFormattedDateTime: Given a Time, Returns a string that is formatted ready to be inserted into an SQLite Datetime field using sql.Prepare.
func GetSQLiteFormattedDateTime(t time.Time) string {
// This date is used to indicate the layout.
const datetimeLayout = "2006-01-02 15:04:05"
formatedDatetime := t.Format(datetimeLayout)
return formatedDatetime
}
// GetPath : Returns either the hardcoded path, or a overwritten value via .env file at project root. Register paths here for seamless working code between dev and prod environments ;)
func GetPath(pathKey string) string {