GOGO_MDC

package module
v0.0.0-...-4a722bc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CST_Location_OBJ, _ = time.LoadLocation("America/Chicago") // aka CST	}
View Source
var EST_Location_OBJ, _ = time.LoadLocation("America/New_York")
View Source
var LOCAL_Location_OBJ, _ = time.LoadLocation("Local")

Use ful Time zone locations

View Source
var MST_Location_OBJ, _ = time.LoadLocation("America/Denver") // MDT / Mountain Standard
View Source
var PST_Location_OBJ, _ = time.LoadLocation("America/Los_Angeles") // aka PST
View Source
var UTC_Location_OBJ, _ = time.LoadLocation("UTC")

Functions

func CHECK_for_SUPPORTED_DATE_INPUT

func CHECK_for_SUPPORTED_DATE_INPUT(inputDate string) (bool, map[string]interface{})

func CONVERT_DATE

func CONVERT_DATE(ALL_PARAMS ...interface{}) (string, string, time.Time)

Converts the following

  • a STRING date (in the proper format) to a time.Time DATE_OBJ
  • a DATE_OBJ into a 'pretty date'
  • an EPOCH .. into a pretty date.. and time.Time Date_OBJ (specify this with int(EPOCH_wasint64) .. this is because Go doesnt recognize int64 as a param explicitly

TZONE: Specify cst, est, mdt or pst if you need to override the timezone format returned

STRING format for the Date must be in one of the following or you will error:

  • MM-DD-YYYY

  • YYYY-MM-DD (ISO / British format)

  • MM/DD/YYYY

  • YYYY/MM/DD

    Also accepts TIME.. Which must be apppended as: (24 hour format only supported)

  • XXXXX_18:05

  • XXXXX@18:05

Final param is for FORMAT specifiy: basic, simple, full, nano, british, justtime, justdate, timestamp (this uses SHOW_PRETTY_DATE ) You can also modify format by adding: _noday (ie, basic_noweek) - Prevents the weekday info from showing _nozone - prevents the timezone info from showing _reset_time - For situations where you want to omit the HH:MM cause you dont need it...resets time to 00:00

func DATE_IS_AFTER

func DATE_IS_AFTER(first, prev time.Time) bool

Easy way to find if FIRST date is AFTER the PREV DATE

func DATE_IS_BEFORE

func DATE_IS_BEFORE(first, prev time.Time) bool

Correspondingly a date that is BEFORE

func DISPLAY_TIME_DIFF

func DISPLAY_TIME_DIFF(startTime time.Time, endTime time.Time) string

Takes in two date objects and returns the TIME DIFFERNCE between them in the 5m40s format

func DateMath

func DateMath(dateObj time.Time, operation string, v_amount int, interval string) (string, time.Time)
Takes in a date object and adds or subtracts

based on the number and whatever operation you specify returns a date object

func FIX_FLOAT_PRECISION

func FIX_FLOAT_PRECISION(num float64, precision int) float64

func FIX_if_needed

func FIX_if_needed(input string) string

func GET_DATE_DIFF

func GET_DATE_DIFF(mtype string, currDATE time.Time, prevDATE time.Time) int

Gets the difference between two dates (by days, hour or minutes)

func GET_DAYS_SINCE

func GET_DAYS_SINCE(past time.Time, curr_time time.Time) float64

Pass PREVIOUS time.. then current or alt time)

func GET_DAYS_UNTIL

func GET_DAYS_UNTIL(future time.Time, curr_time time.Time) float64

pass future time, then current or alt time

func GET_DB_DATE_UTC

func GET_DB_DATE_UTC(input_DATE_OBJ time.Time) (time.Time, string, string, string)

Easy way to get the UTC form of DATE_OBJ so there is no confusion.. Returns Time, String(pretty date) and Weekday all converted from the orig time

func GET_DIFF

func GET_DIFF(ALL_PARAMS ...interface{}) float64

Ultimate get diff of two dumbers

func GET_DURATION

func GET_DURATION(startTIME time.Time, endTIME time.Time, EXTRA_ARGS ...string) (float64, string, string)

Takes in Two Time periods.. and returns the duration in DAYS, Hours and Minutes (and comprable strings) Returns MINS, HOURS, DAYS (in float first, then strings)

func GET_INCDEC_PERCENT

func GET_INCDEC_PERCENT(ALL_PARAMS ...interface{}) (float64, string, string, float64)

Returns Percentages INCREASE DECREASE for stocks etc... Takes in floats or INTs

As of MAY 2023.. This is the ULTIMATE GET PERCENTAGE function (replaces the previous GET_PRECENT)
Also returns the DIFF between two numbers and if it was an INCREASE or DECERASE based on which number was passed FIRST

RETURNS:
res_PERC, changeTYPE, res_DESC, res_diff

func GET_RATIO

func GET_RATIO(smallNUM float64, bigNUM float64, EXTRA_ARGS ...bool) float64

func GET_TIME_DIFF

func GET_TIME_DIFF(startTime time.Time, endTime time.Time) string

Alias for DISPLAY_TIME_DIFF (which lives in GO_GO_Gadgets)

func GET_Time_SINCE

func GET_Time_SINCE(past time.Time, curr_time time.Time, format string) float64

Pass PREVIOUS time.. then current or alt time) .. also send format: days or mins (defaults to hours)

func GET_Time_UNTIL

func GET_Time_UNTIL(future time.Time, curr_time time.Time, format string) float64

pass future time, then current or alt time .. also send format: days or mins (defaults to hours)

func IS_EVEN

func IS_EVEN(input_NUM int) bool

Tells you if an INT is even

func IS_ODD

func IS_ODD(input_NUM int) bool

Tells you if an INT is ODD

func MakeRound

func MakeRound(num float64) int

Makes a floating point number rounded up and returns integer

func PERCENT_OF

func PERCENT_OF(ALL_PARAMS ...interface{}) float64

Ultimate percentage of two numbers

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL