Created
July 21, 2020 18:00
-
-
Save parzibyte/da65a067d2a3c2e641f1a6e3710aa84d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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