Пример #1
0
func (this *Eval) evalDate(stmt *ast.Stmt) (*ast.Stmt, error) {
	format := stmt.Value.(string)
	t := stdtime.Now()
	stmt.Value = time.Format(t, format)
	stmt.Prop["time"] = t
	stmt.Prop["format"] = format
	return stmt, nil
}
Пример #2
0
func NewDate(t stdtime.Time, format string) *Stmt {
	return &Stmt{
		Type:  Date,
		Value: time.Format(t, format),
		Prop: map[string]interface{}{
			"time":   t,
			"format": format,
		},
	}
}
Пример #3
0
func TestFormat(t *testing.T) {
	fmt.Println(time.Format(stdtime.Now(), "YYYYMMDD hh:mm:ss"))
}