SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- {
- "name" : "hello",
- "lastModified" : 1438167001716
- }
- type Model struct {
- Name string `json:"name"`
- Lastmodified time.Time `json:"lastModified"`
- }
- type Model struct {
- Name string `json:"name"`
- Millis int64 `json:"lastModified"`
- }
- func (m Model) Lastmodified() time.Time {
- return time.Unix(0, m.Millis * int64(time.Millisecond))
- }
- type Model struct {
- Name string `json:"name"`
- Lastmodified javaTime `json:"lastModified"`
- }
- type javaTime time.Time
- func (j *javaTime) UnmarshalJSON(data []byte) error {
- millis, err := strconv.ParseInt(string(data), 10, 64)
- if err != nil {
- return err
- }
- *j = javaTime(time.Unix(0, millis * int64(time.Millisecond)))
- return nil
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.