Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 21, 2020 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/da65a067d2a3c2e641f1a6e3710aa84d to your computer and use it in GitHub Desktop.
Save parzibyte/da65a067d2a3c2e641f1a6e3710aa84d to your computer and use it in GitHub Desktop.
// https://parzibyte.me/blog
package main
import (
"fmt"
"time"
)
func main() {
var Dias = []string{"Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"}
fecha := "2020-07-21"
// 2006-01-02 es layout de YYYY-MM-DD. No modificar
t, err := time.Parse("2006-01-02", fecha)
if err != nil {
panic(err)
}
dia := Dias[t.Weekday()]
fmt.Printf("En la fecha %s fue %s", fecha, dia)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment