Jump to content

Defining a datetime 31 days in the future?


woolyg

Recommended Posts

Hi all,

I'm taking information from a form that defines a starting time for an advert, as follows:

 

 

<?php
$start_day = $_POST['ad_start_day'];
$start_month = $_POST['ad_start_month'];
$start_year = $_POST['ad_start_year'];
$ad_start_date = $start_year."-".$start_month."-".$zero.$start_day." "."00:00:00";
?>

 

Now, i'd like to define $ad_end_date to be 31 days after $ad_start_date.. how do I do this?

 

I've looked at mktime() and strtotime() but neither are very clear, and both arent working for me!

 

Cheers,

Woolyg

Thanks -

 

I ended up using:

 

<?php
$start_day = $_POST['vacancy_start_day'];
$start_month = $_POST['vacancy_start_month'];
$start_year = $_POST['vacancy_start_year'];

$vacancy_start_date = $start_year."-".$start_month."-".$zero.$start_day." "."00:00:00";
$vacancy_end_date = date("Y-m-d H:i:s", strtotime("$vacancy_start_date + 31 days"));
?>

 

- Woolyg

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.