Skip to content

Instantly share code, notes, and snippets.

@brianium
Last active August 29, 2015 14:11
Show Gist options
  • Save brianium/3a652d6d0aa268e362e5 to your computer and use it in GitHub Desktop.
Save brianium/3a652d6d0aa268e362e5 to your computer and use it in GitHub Desktop.
interval.go
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