time.Weekday.String() Function in Golang With Examples
Last Updated :
21 Apr, 2020
In Go language, time packages supplies functionality for determining as well as viewing time. The Weekday.String() function in Go language is used to find the English name of the day. Moreover, this function is defined under the time package. Here, you need to import the “time” package in order to use these functions.
Syntax:
func (d Weekday) String() string
Here, “d” is the type Weekday.
Return value: It returns a string which is the English name of the day.
Example:
package main
import "fmt"
import "time"
func main() {
var d = time .Weekday(0)
var e = time .Weekday(1)
var f = time .Weekday(2)
var g = time .Weekday(3)
var h = time .Weekday(4)
var i = time .Weekday(5)
var j = time .Weekday(6)
fmt.Println(d.String())
fmt.Println(e.String())
fmt.Println(f.String())
fmt.Println(g.String())
fmt.Println(h.String())
fmt.Println(i.String())
fmt.Println(j.String())
}
|
Output:
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...