Day of the Year Solutions in GoNumber 1154Difficulty EasyAcceptance 49.3%Link LeetCodeOther languages C++SolutionsGo solution by halfrost/LeetCode-Gopackage leetcode import "time" func dayOfYear(date string) int { first := date[:4] + "-01-01" firstDay, _ := time.Parse("2006-01-02", first) dateDay, _ := time.Parse("2006-01-02", date) duration := dateDay.Sub(firstDay) return int(duration.Hours())/24 + 1}package leetcode import "time" func dayOfYear(date string) int { first := date[:4] + "-01-01" firstDay, _ := time.Parse("2006-01-02", first) dateDay, _ := time.Parse("2006-01-02", date) duration := dateDay.Sub(firstDay) return int(duration.Hours())/24 + 1 }