Christopher Francisco
Christopher Francisco

Reputation: 16268

CakePHP date 5 days from now using CakeTime

I need to create a date to be stored in mysql. The date is 5 days from now. I thought maybe CakeTime::dayAsSql('+5 days') but I'm missing a parameter which the documentation doesn't describes and also I dont really know if this will give me what I need. Any ideas?

Upvotes: 0

Views: 195

Answers (1)

floriank
floriank

Reputation: 25698

Have you read the documentation at all? I'm asking because CakeTime::dayAsSql() is clearly not what you want:

Returns a partial SQL string to search for all records between two times occurring on the same day.

Use CakeTime::format():

echo CakeTime::format('+5 days', '%B %e, %Y %H:%M %p');

Upvotes: 2

Related Questions