title: time.Parse with custom layout
body: <p>I'm trying to parse this string pattern <code>"4-JAN-12 9:30:14"</code> into a <code>time.Time</code>.</p>
  
  <p>Tried <code>time.Parse("2-JAN-06 15:04:05", inputString)</code> and many others but cannot get it working.</p>
  
  <p>I've read <a href="http://golang.org/pkg/time/#Parse" rel="nofollow">http://golang.org/pkg/time/#Parse</a> and <a href="https://gobyexample.com/time-formatting-parsing" rel="nofollow">https://gobyexample.com/time-formatting-parsing</a> but it seems there aren't any examples like this.</p>
  
  <p>Thanks!</p>
  
  <p>Edit:
  full code:</p>
  
  <pre><code>type CustomTime time.Time
  
  func (t *CustomTime) UnmarshalJSON(b []byte) error {
      auxTime, err := time.Parse("2-JAN-06 15:04:05", string(b))
      *t = CustomTime(auxTime)
      return err
  }
  </code></pre>
  
  <blockquote>
    <p>parsing time ""10-JAN-12 11:20:41"" as "2-JAN-06 15:04:05": cannot
    parse ""24-JAN-15 10:27:44"" as "2"</p>
  </blockquote>