Code snippets with tests and testable examples for the Go programming language

How to check that a time value is a specific day of the week

Snippets Index - Run code on Go playground - Edit

package main

import (

func Example() {
	// The time package offers a time.Weekday() method which returns
	// a time.Weekday value
	now := time.Now()
	if now.Weekday() == time.Tuesday {
		fmt.Println("The day on Go playground is always Tuesday")
	// Output:
	// The day on Go playground is always Tuesday

by psampaz - source code - comment below or here