mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 01:21:38 +08:00
28 lines
440 B
Go
Executable File
28 lines
440 B
Go
Executable File
package greetings
|
|
|
|
import "time"
|
|
|
|
func GoodDay(name string) string {
|
|
return "Good Day " + name
|
|
}
|
|
|
|
func GoodNight(name string) string{
|
|
return "Good Night " + name
|
|
}
|
|
|
|
func IsAM() bool {
|
|
localTime := time.Now()
|
|
return localTime.Hour() <= 12
|
|
}
|
|
|
|
func IsAfternoon() bool {
|
|
localTime := time.Now()
|
|
return localTime.Hour() <= 18
|
|
}
|
|
|
|
func IsEvening() bool {
|
|
localTime := time.Now()
|
|
return localTime.Hour() <= 22
|
|
}
|
|
|