From 5bed4233afe9404d19916f6e66d9396e24a848fc Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 18 Dec 2024 20:25:53 +0000 Subject: Better date formatting --- tjp.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tjp.go b/tjp.go index ba9c3b0..b192189 100644 --- a/tjp.go +++ b/tjp.go @@ -117,12 +117,16 @@ func formatVertically(id sql.NullInt64, dateAdded sql.NullTime, entry sql.NullSt } func formatHorizontally(dateAdded sql.NullTime, entry sql.NullString, comment sql.NullString) { - fmt.Printf("%s | %s | %s\n", formatShortTime(dateAdded), formatString(entry), formatString(comment)) + fmt.Printf("%s %s | %s | %s\n", formatShortTime(dateAdded), getWeekdayFromDate(dateAdded), formatString(entry), formatString(comment)) +} + +func getWeekdayFromDate(date sql.NullTime) string { + return date.Time.Format("Monday") } func formatShortTime(t sql.NullTime) string { if t.Valid { - return t.Time.Format("2006-01-02T15:04") + return t.Time.Format("2006-01-02 15:04") } return "NULL" } -- cgit v1.2.3