-
-
Save dfang/f1ffc08bb084b5a50c3b9a278e4ddedf to your computer and use it in GitHub Desktop.
gorilla schema - convert html date
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
import( | |
"reflect" | |
"time" | |
"github.com/gorilla/schema" | |
) | |
func ConvertFormDate(value string) reflect.Value { | |
s, _ := time.Parse("2006-01-_2", value) | |
return reflect.ValueOf(s) | |
} | |
func usage() { | |
decoder := schema.NewDecoder() | |
decoder.RegisterConverter(time.Time{}, ConvertFormDate) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment