Skip to content

crosslogic/fecha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fecha

Este package permite trabajar con fechas y períodos mensuales. Desarrolado para uso propio. Incluye métodos para serialización binaria utilizada por package pgx.

    _, _ := fecha.NewFechaFromString("2020-08-23")
    _ := fecha.NewFechaFromInts(2020, 8, 23)
    _ := fecha.NewFechaFromLayout("02/01/2006", "23/08/2020")
    _ := fecha.NewFechaFromTime(time.Now())

Utiliza con un int como tipo subyacente, por lo que las comparaciones son fáciles:

    f1, _ := fecha.NewFechaFromString("2020-08-23")
    f1, _ := fecha.NewFechaFromString("2020-08-24")

    _ := f1 > f0 // true
    _ := f1 == f2 // false

    f3, _ := fecha.NewFechaFromString("2020-08-23")
    _ := f1 == f3 // true

Operaciones con fechas:

f, _ = fecha.NewFechaFromInts(2020, 8, 21)
_ = f.AgregarDias(5)  // 2020-08-26
_ = f.AgregarDiasHabiles(5) // 2020-08-28

// Diferencia dias
f0 := fecha.Fecha(20190823)
dias := fecha.Diff(f0, f1)   // 366

About

fecha está pensado para simplificar el trabajo con fechas.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages