PHP's well used:
Code: Select all
$today = (date('Y-m-d'));However, what do I do to gather the date in a fortnight's time??
Simon
Moderator: General Moderators
Code: Select all
$today = (date('Y-m-d'));Code: Select all
$today = time();//Unix Time Stamp
$amount_of_days = 14; //Number of days to add
$futuretime = 60 * 60 * 24 * $amount_of_days; //60 seconds times 60 minutes times 24 hours times the number of days ahead
$futuredate = date('Y-m-d', $futuretime) //put in date formatCode: Select all
$futuredate = strtotime("+14 day");
The second gives:1970-01-15
Something not quite right?1249496533
Code: Select all
<?php
$fortnight = date("Y-m-d", (time() + (86400*14)));
echo $fortnight;
?>Code: Select all
variable = subscription date + 14 days.
if the result of (variable) <= todayDate, then do something.Code: Select all
$fortnight = date("Y-m-d", (time() + (86400*14)));The following should work:simonmlewis wrote:Damn it - just realised I don't a fortnight ahead of today, but a fortnight ahead of a given day.
It's the Pseucode:
Can anyone help please, bearing in mind I have the code below?Code: Select all
variable = subscription date + 14 days. if the result of (variable) <= todayDate, then do something.Code: Select all
$fortnight = date("Y-m-d", (time() + (86400*14)));
Code: Select all
$subDateMicrotime = strtotime('subscription date');
$fortnight = date( "Y-m-d", ($subDateMicrotime + (86400*14)) );
Code: Select all
$timeStamp = strtotime("$row->subscribed");
$timeStamp += 24 * 60 * 60 * 14;
$fortnight = date("Y-m-d", $timeStamp);
if ($timestamp <= $fortnight) {......................
Good!simonmlewis wrote:That works - however I now now have stage two to complete.
Code: Select all
var_dump(date("Y-m-d", strtotime("next fortnight", strtotime("2008-02-10"))));