Forum Moderators: coopster

Message Too Old, No Replies

help with Date/Time

         

adammc

2:01 am on Jul 14, 2006 (gmt 0)

10+ Year Member



Hi folks,

Any help would be greatly appreciated, I am REALLY stuck on this one.

Date/Time of posting is being inserted using this method:

$timezone = +10; // Australian time

<input type="hidden" name="date" value="<? print gmdate("Y/m/d @ H:i:s", time() + 3600*($timezone+date("I")));?>"> 

$date is then inserted into the 'date_reg' column of the DB.

Ok, what I am having problems with is how to get an expiry date into the correct timezone format (+10)to place into the expiry_date column.

I have been trying everything with not much success. I have tried something like this:

$addDays = 5; // or any number of days you want to add up to 28 you'll need to add code if you want this to handle multiple month jumps

$expiry_date = strtotime("$addDays", strtotime($date));
$new_expiry_date = date("Y/m/d @ H:i:s",$expiry_date);

Tried it this way as well:

$_POST[exdays1] - comes from form field

$EXday = date('d', mktime(0,0,0,0, date(d) + $_POST[exdays1], 0));

$EXmonth = date('m', mktime(0,0,0, date(m), date(d) + $_POST[exdays1], 0));

$EXyear = date('Y', mktime(0,0,0,date(m) ,date(d) + $_POST[exdays1], date(Y)));

to insert into the DB:


EXmonth = \"$EXmonth\",
EXday = \"$EXday\",
EXyear = \"$EXyear\" ";

Can anyone help? This is driving me nuts!

Sekka

8:33 am on Jul 14, 2006 (gmt 0)

10+ Year Member



Try and use the time () function,

$5daysfromnow = time () + (60 * 60 * 24 * 5);

$date_Today = date('Y-m-d');
$date_5days = date('Y-m-d', $5daysfromnow);