summaryrefslogtreecommitdiff
path: root/formatTime.go
diff options
context:
space:
mode:
Diffstat (limited to 'formatTime.go')
-rw-r--r--formatTime.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/formatTime.go b/formatTime.go
new file mode 100644
index 0000000..2dcc3c2
--- /dev/null
+++ b/formatTime.go
@@ -0,0 +1,15 @@
+package cobol
+
+import (
+ "time"
+)
+
+// there is only one way to display the time as text
+// this is that way. Don't like it? Don't use COBOL
+func FormatTime(t time.Time) string {
+ localTime := t.Local()
+ s := localTime.Format("2006/01/02 15:04:03")
+ dur := time.Since(t)
+ //always time, two spaces, (duration)
+ return s + " (" + FormatDuration(dur) + ")"
+}