diff options
author | Matthew Lemon <y@yulqen.org> | 2024-12-18 20:25:53 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-12-18 20:25:53 +0000 |
commit | 5bed4233afe9404d19916f6e66d9396e24a848fc (patch) | |
tree | 280beff8737570c1b90a8db5be63053dabf08913 | |
parent | cfdb1167651e57ad47b8ac74c6bc179ebed98eba (diff) |
Better date formatting
-rw-r--r-- | tjp.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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" } |