Every line of 'golang time format' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.
118 func FormatWithTime(text string) (result string) { 119 result = text 120 121 matches := retime.FindAllStringSubmatch(result, -1) 122 for _, submatches := range matches { 123 value := time.Now().Format(submatches[1]) 124 result = strings.Replace(result, submatches[0], value, -1) 125 } 126 127 return 128 }
196 func (t *templateFunctions) timeStampFormat(layout string, v map[string]interface{}) string { 197 ts := v["@timestamp"] 198 ti, err := cast.ToTimeE(ts) 199 if err != nil { 200 return "" 201 } 202 return jodaTime.Format(layout, ti) 203 }
89 func GetUnixTimeStr(ut int64,format string)(string){ 90 t := time.Unix(ut,0) 91 return GetTmStr(t,format) 92 }
258 func inlineParseModeledTime(format, v string) string { 259 const formatTimeTmpl = `func() *time.Time{ 260 v, err := protocol.ParseTime("%s", "%s") 261 if err != nil { 262 panic(err) 263 } 264 return &v 265 }()` 266 267 return fmt.Sprintf(formatTimeTmpl, format, v) 268 }
338 func (c *console) AppendTime(buf *bytes.Buffer, t time.Time) { 339 s := t.Format(timeFormat) 340 appendString(buf, s, false) 341 }
238 func FmtTime(sec int64, step TimeDelta) string { 239 t := time.Unix(sec, 0) 240 return step.Format(t) 241 }
181 func formatTime(t time.Time, layout string) string { 182 return t.Format(layout) 183 }
15 func timeFormat(t time.Time, format string) string { 16 return t.Format(format) 17 }
167 func parse(format string, t time.Time) string { 168 result := "" 169 for _, s := range format { 170 result += recognize(string(s), t) 171 } 172 return result 173 }
37 func timeFmtOr(t *time.Time, fmt, def string) string { 38 if t == nil { 39 return def 40 } 41 return t.Format(fmt) 42 }