summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-12-18 20:25:53 +0000
committerMatthew Lemon <y@yulqen.org>2024-12-18 20:25:53 +0000
commit5bed4233afe9404d19916f6e66d9396e24a848fc (patch)
tree280beff8737570c1b90a8db5be63053dabf08913
parentcfdb1167651e57ad47b8ac74c6bc179ebed98eba (diff)
Better date formatting
-rw-r--r--tjp.go8
1 files 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"
}