Last active
August 29, 2015 14:11
-
-
Save brianium/3a652d6d0aa268e362e5 to your computer and use it in GitHub Desktop.
interval.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"time" | |
"fmt" | |
) | |
type Interval struct { | |
Start time.Time | |
End time.Time | |
} | |
func NewInterval(start string, end string) Interval { | |
startTime, _ := time.Parse(time.RFC3339, start) | |
endTime, _ := time.Parse(time.RFC3339, end) | |
return Interval{Start:startTime, End:endTime} | |
} | |
func main() { | |
interval := NewInterval("2013-02-27T19:35:32Z", "2013-03-27T19:35:32Z") | |
fmt.Println(interval) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment