Skip to content

Instantly share code, notes, and snippets.

@ProTip
Created July 28, 2014 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ProTip/ec50b2a88fa8f8bea2e3 to your computer and use it in GitHub Desktop.
Save ProTip/ec50b2a88fa8f8bea2e3 to your computer and use it in GitHub Desktop.
func ParseBillingPeriodDate(s string, report *BillingReport) interface{} {
var returnTime time.Time
var err error
switch s { case "":
returnTime = report.InvoicePeriod
default:
returnTime, err = time.Parse("2006/01/02 15:04:05", s)
if err != nil { panic(err.Error()) }
}
return returnTime.Format(time.RFC3339)
}
//
func ParseBillingPeriodDate(s string, report *BillingReport) interface{} {
var returnTime time.Time
var err error
switch s {
case "":
returnTime = report.InvoicePeriod
default:
returnTime, err = time.Parse("2006/01/02 15:04:05", s)
if err != nil {
panic(err.Error())
}
}
return returnTime.Format(time.RFC3339)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment