Last active
April 25, 2018 05:53
-
-
Save vishakvkt/c15ac55a677b432a099d 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
Very nice. Thank you very much!