rvdb86 Posted February 10, 2009 Share Posted February 10, 2009 Hi, i hope someone can help me with the following: I have a date stored in SQL table in the following format Y-m-d I want to add 30 days to that date ??? Any one have any ideas that could help me? Thanks in advance!! Link to comment https://forums.phpfreaks.com/topic/144700-date-trouble/ Share on other sites More sharing options...
printf Posted February 10, 2009 Share Posted February 10, 2009 When you SELECT it? Or when you update it? Link to comment https://forums.phpfreaks.com/topic/144700-date-trouble/#findComment-759307 Share on other sites More sharing options...
rvdb86 Posted February 10, 2009 Author Share Posted February 10, 2009 when i select it. it is selected in a file application_top.php and defined eg: define("SITE_Date_registered", $customer_regdate); i want to add 30 days to SITE_Date_registered Link to comment https://forums.phpfreaks.com/topic/144700-date-trouble/#findComment-759312 Share on other sites More sharing options...
printf Posted February 10, 2009 Share Posted February 10, 2009 You cannot change it if you define it as a CONSTANT, constants cannot be changed once defined CONSTANT! Link to comment https://forums.phpfreaks.com/topic/144700-date-trouble/#findComment-759313 Share on other sites More sharing options...
rvdb86 Posted February 10, 2009 Author Share Posted February 10, 2009 ahh oops and if i dont define it as a constant? Link to comment https://forums.phpfreaks.com/topic/144700-date-trouble/#findComment-759319 Share on other sites More sharing options...
printf Posted February 10, 2009 Share Posted February 10, 2009 Then like so... <?php $customer_regdate = '2009-01-01'; $customer_regdate = gmdate ( 'Y-m-d', strtotime ( $customer_regdate . '+ 30 DAYS' ) ); echo $customer_regdate; // or, now you can define it define ( 'SITE_Date_registered', $customer_regdate ); ?> Link to comment https://forums.phpfreaks.com/topic/144700-date-trouble/#findComment-759320 Share on other sites More sharing options...
rvdb86 Posted February 11, 2009 Author Share Posted February 11, 2009 wow thanks so much. its easy when you know how maybe you can help me with my next problem? how would i subrtact the new thirty days date from the current date to display how many says are left? again thanks so much for your help! Link to comment https://forums.phpfreaks.com/topic/144700-date-trouble/#findComment-759338 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.