Documentation
¶
Overview ¶
Package time contains some useful functions to manage timestamps in the same representation that PostgreSQL uses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToPostgresFormat ¶
ConvertToPostgresFormat converts timestamps to PostgreSQL time format, if needed. e.g. "2006-01-02T15:04:05Z07:00" --> "2006-01-02 15:04:05.000000Z07:00" If the conversion fails, the input timestamp is returned as it is.
func DifferenceBetweenTimestamps ¶
DifferenceBetweenTimestamps returns the time.Duration difference between two timestamps strings in time.RFC3339.
func GetCurrentTimestamp ¶
func GetCurrentTimestamp() string
GetCurrentTimestamp returns the current timestamp as a string in RFC3339Micro format
func GetCurrentTimestampWithFormat ¶
GetCurrentTimestampWithFormat returns the current timestamp as a string with the specified format
func ToCompactISO8601 ¶
ToCompactISO8601 converts a time.Time into a compacted version of the ISO8601 timestamp, removing any separators for brevity.
For example:
Given: 2022-01-02 15:04:05 (UTC) Returns: 20220102150405
This compact format is useful for generating concise, yet human-readable timestamps that can serve as suffixes for backup-related objects or any other contexts where space or character count might be a concern.
Types ¶
This section is empty.