date

package
v0.0.0-...-9d0e06d Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeZoneSaoPaulo       = "America/Sao_Paulo"
	DateTimeFormatDatabase = "2006-01-02T15:04:05"
	DateFormatDatabase     = "2006-01-02"
	DateTimeBr             = "02/01/2006 15:04:05"
	DateBr                 = "02/01/2006"
	Days                   = time.Hour * 24
)

Variables

This section is empty.

Functions

func DateEqual

func DateEqual(date1, date2 time.Time) bool

DateEqual compare two dates if they are equals, ignoring the time and considering only the date return true if they are equals

func FirstDayOfMonth

func FirstDayOfMonth(t time.Time) time.Time

FirstDayOfMonth return the time and set day 1

func FromString

func FromString(date string) (r time.Time)

FromString function to return a time.Time given a string, it automatically tries to convert from several and common formats, if it has error, return time zeroValue

func GetDateFromTime

func GetDateFromTime(v time.Time, timezone TimeZones) time.Time

func GetDaysBetweenDates

func GetDaysBetweenDates(startDate, endDate time.Time) int

GetDaysBetweenDates return the diference of the of days between two dates object

func GetEndOfTheDay

func GetEndOfTheDay(v time.Time) time.Time

GetEndOfTheDay essa funcao altera um horario para o final do dia, 23:59:59

func GetMonthName

func GetMonthName(date time.Time, lang language.Tag) string

GetMonthName retorna o nome do mês baseado na lingua passada como parametro, padrao é ingles

func GetNextDayOfWeek

func GetNextDayOfWeek(t time.Time) time.Time

IsWeekend retorna o próximo dia da semana

func GetStartOfTheDay

func GetStartOfTheDay(v time.Time) time.Time

GetStartOfTheDay essa funcao altera um horario para o inicio do dia, 00:00:00

func GetTempo

func GetTempo(duration time.Duration) (r string)

GetTempo retorna uma string informado o tempo em portugues que falta a partir de um objeto Duration

func IntToTime

func IntToTime(v int64) time.Time

IntToTime Convert time in int64 format to time.Time type

func IsWeekend

func IsWeekend(t time.Time) bool

IsWeekend retorna se uma data e final de semana ou nao

func LastDayOfMonth

func LastDayOfMonth(t time.Time) time.Time

LastDayOfMonth return the time with last day of the month

func NextDateByDay

func NextDateByDay(day, maxDay int) time.Time

NextDateByDay retorna a proxima data baseado no dia

func NextDay

func NextDay(t time.Time) time.Time

func TimeStampToDateString

func TimeStampToDateString(timestamp *timestamp.Timestamp) string

func TimeStampToDateTimeString

func TimeStampToDateTimeString(timestamp *timestamp.Timestamp) string

func TimeStampToTime

func TimeStampToTime(timestamp *timestamp.Timestamp) time.Time

func TimeToString

func TimeToString(timestamp time.Time) string

func TimeToStringPtBR

func TimeToStringPtBR(timestamp time.Time) string

func TimeToTimeStamp

func TimeToTimeStamp(time time.Time) *timestamp.Timestamp

func ToTime

func ToTime(v interface{}) time.Time

ToTime convert interface to Time

Types

type TimeZones

type TimeZones string

Jump to

Keyboard shortcuts

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