Kiva
Kiva

Reputation: 9363

Manipulate date with symfony 1.4

I would like to know if a class exists to manipulate date with symfony 1.4

I search a class like Calandar in Java where you can manipulate date with method like "add" to add x days to a date.

I found sfDatePlugin but it seems to work only symfony 1.2

Do you know a class like this ?

Upvotes: 1

Views: 1579

Answers (1)

Jeremy Kauffman
Jeremy Kauffman

Reputation: 10413

Use the built-in PHP DateTime class and the modify method:

$dt = new DateTime(); //will be now
$dt->modify('+3 days');
$dt->format('m/d/Y'); //takes the same params as date()

Upvotes: 1

Related Questions