Documentation
¶
Overview ¶
Dow package provide functions to get the name of the day of the week.
The locales supported by this package depend on github.com/goodsign/monday. https://pkg.go.dev/github.com/goodsign/monday#pkg-constants
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocaleName ¶
Get the locale name of the day of the week for a given date
If the specified locale is not supported, returns the name of the day of the week in the en_US locale.
Example ¶
package main
import (
"fmt"
"time"
"github.com/umi-uyura/dow"
)
func main() {
d, _ := time.Parse("2006-1-2", "2023-1-1")
weekday := dow.GetLocaleName(d, "ja_JP")
fmt.Println(weekday)
}
Output: 日
func GetLocaleNameWithDate ¶
Get the locale name of the day of the week for a given date with the date
If the specified locale is not supported, returns the name of the day of the week in the en_US locale.
Example ¶
package main
import (
"fmt"
"time"
"github.com/umi-uyura/dow"
)
func main() {
d, _ := time.Parse("2006-1-2", "2023-1-1")
weekday := dow.GetLocaleNameWithDate(d, "ja_JP")
fmt.Println(weekday)
}
Output: 2023-1-1(日)
func GetName ¶
Get the name of the day of the week for a given date.
Return the name of the day of the week in en_US locale.
Example ¶
package main
import (
"fmt"
"time"
"github.com/umi-uyura/dow"
)
func main() {
d, _ := time.Parse("2006-1-2", "2023-1-1")
weekday := dow.GetName(d)
fmt.Println(weekday)
}
Output: Sun
func GetNameWithDate ¶
Get the name of the day of the week for a given date with the date.
Return the name of the day of the week in en_US locale.
Example ¶
package main
import (
"fmt"
"time"
"github.com/umi-uyura/dow"
)
func main() {
d, _ := time.Parse("2006-1-2", "2023-1-1")
weekday := dow.GetNameWithDate(d)
fmt.Println(weekday)
}
Output: 2023-1-1(Sun)
Types ¶
This section is empty.