...

View Full Version : Resolved how do I add on one year? to date??



low tech
12-02-2010, 05:03 AM
Hello everyone


how do I add on one year???

this gives me my date but I need to add 1 year
'".date("Y-m-d H:i:s", strtotime(mysql_real_escape_string($exp_date)))."',


I tried this --- but it failed (i'm trying to set a future expiry date)
'".date("Y-m-d H:i:s", strtotime(mysql_real_escape_string($exp_date "+1 year")))."',


ALSO i'm unsure about this

on MySQL INSERT I use now() to add another date field

do I need to use mysql_real_escape_string around now()


thanks

LT

seco
12-02-2010, 06:42 AM
What does $exp_date look like before its ran through the date function

low tech
12-02-2010, 06:51 AM
Hi seco

Expiry date is expected like this

00:31:02 Nov 03 2010 PDT


ALSO i'm unsure about this

on MySQL INSERT I use now() to add another date field

do I need to use mysql_real_escape_string around now()


Thanks

ps If I can't add one year to my set up as i have it now, I guess I could rearrange and not use teh date var that I am getting

LT

poyzn
12-02-2010, 10:21 AM
<?php
$date = date("Y-m-d H:i:s", time() + 60 * 60 * 24 * 365); // now + one year
?>

low tech
12-02-2010, 10:39 AM
Thanks poyzn

any idea on

ALSO i'm unsure about this

on MySQL INSERT I use now() to add another date field

do I need to use mysql_real_escape_string around now()

I'm not using at the moment but wonder if I should / need to??

LT

abduraooft
12-02-2010, 10:42 AM
<?php
$date = date("Y-m-d H:i:s", time() + 60 * 60 * 24 * 365); // now + one year
?>


echo date("Y-m-d H:i:s", strtotime("Now + 1 year"));

low tech
12-02-2010, 10:51 AM
Thanks all

yeh I have this bit now:-)

one small step and all that eh what:-)

LT

poyzn
12-02-2010, 11:21 AM
Thanks poyzn

any idea on

ALSO i'm unsure about this

on MySQL INSERT I use now() to add another date field

do I need to use mysql_real_escape_string around now()

I'm not using at the moment but wonder if I should / need to??

LT

No, you don't need to use mysql_real_escape_string around now()

low tech
12-02-2010, 11:27 AM
Thanks

I was still wondering hahahhahaa

assumed my question was dumb hahhahaha

LT



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum