ew_CurrentDate() with parameter to add days

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
nyukuri
User
Posts: 123

ew_CurrentDate() with parameter to add days

Post by nyukuri »

Hello,

it would be great if ew_CurrentDate() could be augmented by an optional parameter that allows adding days

ew_CurrentDate(7); // date of next week
ew_CurrentDate(-14); // date of two weeks ago

that would very much help with comparing dates.

Same should be done with ew_CurrentTime()... adding hours or minutes etc.


Webmaster
User
Posts: 9427

Post by Webmaster »

  1. To compare dates, use:

ew_DateDiff($dateTimeBegin, $dateTimeEnd, $interval = "d")

where $dateTimeBegin and $dateTimeEnd are dates as string which will be converted to date by strtotime() for comparison.

  1. To add time to current time, use PHP's strtotime(), read: http://php.net/manual/en/function.strtotime.php, e.g.

strtotime("+1 hours 10 minutes")


nyukuri
User
Posts: 123

Post by nyukuri »

thank you, that solves the issue :)


Post Reply