From e6fa4d421e9f253715da425e9953e17a5e47f48b Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 14 Oct 2025 10:48:23 -0500 Subject: notes --- formatTime.go | 2 +- time.go | 4 ++++ time.string.go | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/formatTime.go b/formatTime.go index 2cb0da9..23cc5d1 100644 --- a/formatTime.go +++ b/formatTime.go @@ -9,7 +9,7 @@ import ( // 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.Format("2006/01/02 15:04:03") + s := t.UTC().Format("2006/01/02 15:04:03") dur := time.Since(t) //always time, two spaces, (duration) return s + " (" + FormatDuration(dur) + ")" diff --git a/time.go b/time.go index 99a74e7..a1e7828 100644 --- a/time.go +++ b/time.go @@ -29,6 +29,10 @@ func Time(someTimeAgoOrLaterNotsure any) string { return FormatTime(*t) } +func isUTC(t time.Time) bool { + return t.Location() == time.UTC +} + func TimeLocal(someTimeAgoOrLaterNotsure any) string { guess, t, err := TimeCheck(someTimeAgoOrLaterNotsure) if errors.Is(err, Broken) { diff --git a/time.string.go b/time.string.go index b3aa166..22f667d 100644 --- a/time.string.go +++ b/time.string.go @@ -7,6 +7,22 @@ import ( "time" ) +// -------------------------------------------------------------------------------- +// | Your String Component | Example | Go Reference Component | Layout String Part | +// -------------------------------------------------------------------------------- +// | 4-digit year | 2025 | 2006 | 2006 | +// | Separator | / | (literal) | / | +// | 2-digit month | 10 | 01 | 01 | +// | Separator | / | (literal) | / | +// | 2-digit day | 14 | 02 | 02 | +// | Space separator | | (literal) | | +// | 2-digit hour (24h) | 12 | 15 | 15 | +// | Separator | : | (literal) | : | +// | 2-digit minute | 13 | 04 | 04 | +// | Separator | : | (literal) | : | +// | 2-digit second | 12 | 05 | 05 | +// -------------------------------------------------------------------------------- + func doTimeString(BUILDTIME string) (*time.Time, error) { parts := strings.Split(BUILDTIME, " ") if len(parts) == 1 { -- cgit v1.2.3