Canman2005 Posted March 12, 2009 Share Posted March 12, 2009 Hi all I have the following code print date('Y-m-d',strtotime("+2 days")); which works fine. But if I use print date($row['date'],strtotime("+4 days")); It doesn't seem to work. Would anyone know why? Thanks Link to comment https://forums.phpfreaks.com/topic/149058-solved-date-plus-2-days/ Share on other sites More sharing options...
plodos Posted March 12, 2009 Share Posted March 12, 2009 Maybe your database format like date='25-12-2008 18:49:06' is wrong, you need to enter the date as shown. YYYY-MM-DD HH:MM:SS Could you share your dbase date field with inputs.... OR Could you share your mysql query output like insert into tableName set date='25-12-2008 18:49:06' Link to comment https://forums.phpfreaks.com/topic/149058-solved-date-plus-2-days/#findComment-782692 Share on other sites More sharing options...
T-Bird Posted March 12, 2009 Share Posted March 12, 2009 The first parameter of date is a string to tell PHP how to format the output. Do you mean to put: print date('Y-m-d',strtotime("$row['date'] +4 days")); Or does $row['date'] hold a formatting string (similar to "Y-m-d")? Link to comment https://forums.phpfreaks.com/topic/149058-solved-date-plus-2-days/#findComment-782697 Share on other sites More sharing options...
Canman2005 Posted March 12, 2009 Author Share Posted March 12, 2009 Thanks guys, worked a treat Link to comment https://forums.phpfreaks.com/topic/149058-solved-date-plus-2-days/#findComment-782711 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.