コード例 #1
0
ファイル: eval.go プロジェクト: yonglehou/hpipe
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
ファイル: ast.go プロジェクト: yonglehou/hpipe
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
ファイル: util_test.go プロジェクト: yonglehou/hpipe
func TestFormat(t *testing.T) {
	fmt.Println(time.Format(stdtime.Now(), "YYYYMMDD hh:mm:ss"))
}