summaryrefslogtreecommitdiff
path: root/formatTime.go
blob: 23cc5d18de2ee56ae96ea80093a152f5e505dd73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package cobol

// time is relative. keep it that way.

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 {
	s := t.UTC().Format("2006/01/02 15:04:03")
	dur := time.Since(t)
	//always time, two spaces, (duration)
	return s + "  (" + FormatDuration(dur) + ")"
}

func FormatTimeLocal(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) + ")"
}